Thread: Using Application module connection for calling stored procedures.


Permlink Replies: 4 - Pages: 1 - Last Post: Jun 21, 2009 11:05 AM Last Post By: mkonio
ali_nizam

Posts: 984
Registered: 08/15/00
Using Application module connection for calling stored procedures.
Posted: Jun 28, 2007 3:55 AM
Click to report abuse...   Click to reply to this thread Reply
Can we user application module object's connection properties to call Oracle PL/SQL stored prosedure form java.
We don't want to create a new jdbc connection to prevent using more system resources.
iis there any code sample about that.

Thansk a lot...
John Stegeman

Posts: 4,884
Registered: 01/16/06
Re: Using Application module connection for calling stored procedures.
Posted: Jun 28, 2007 4:16 AM   in response to: ali_nizam in response to: ali_nizam
Click to report abuse...   Click to reply to this thread Reply
Ali,

Have a search around - lots of examples on the forum.

Something like this works:

    DBTransaction trans = getDBTransaction();
    
    PreparedStatement stmt = trans.createPreparedStatement("begin mypackage.myproc(:1, :2); end;", 0);
 
    try
    {
      stmt.setInt(1, inputSheetID);
      stmt.setInt(2, planYear);
      
      stmt.execute();
    }


As code in the app module's implementation. You can then expose the method to the client and either call it directly or use the binding layer.

John
bradici

Posts: 15
Registered: 11/20/08
Re: Using Application module connection for calling stored procedures.
Posted: Jun 19, 2009 8:31 AM   in response to: ali_nizam in response to: ali_nizam
Click to report abuse...   Click to reply to this thread Reply
hi, i haev some problème with that.

my case:
1- the user write/edit some data
2- when he commit, the validation rules are trigerred
3- i must use a database stored procedure to validate an attribute (oldest version with forms builder)
4- the procedure don't use the data in cache , so i can't know if the data are right

do you know if an other method exist to call database stored procedure to used data in cache?

ps: i'm in jdev adf 11g (lastest build)

thk you
Shay Shmeltzer

Posts: 10,328
Registered: 03/08/01
Re: Using Application module connection for calling stored procedures.
Posted: Jun 19, 2009 10:54 AM   in response to: ali_nizam in response to: ali_nizam
Click to report abuse...   Click to reply to this thread Reply
mkonio

Posts: 239
Registered: 10/04/07
Re: Using Application module connection for calling stored procedures.
Posted: Jun 21, 2009 11:05 AM   in response to: bradici in response to: bradici
Click to report abuse...   Click to reply to this thread Reply
Calling database procedure is discribed in the developer guide.

But i guess from what you say 2- when he commit, the validation rules are trigerred
that the data need to be posted in database before the procedure is run.

if that is the case you need to run the procedure in doDML method of entity after super.doDML()
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums