Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / July 2004

Tip: Looking for answers? Try searching our database.

Java object as parameter to Java stored procedure

Thread view: 
kastis - 29 Jul 2004 15:55 GMT
What are the steps required to do to pass user defined class object as
the parameter(IN or OUT) to java stored procedure, that class was
uploaded into schema.

thanks
Lee Fesperman - 30 Jul 2004 03:11 GMT
> What are the steps required to do to pass user defined class object as
> the parameter(IN or OUT) to java stored procedure, that class was
> uploaded into schema.

You neglected to mention the DBMS you're using, but the general way is to use
setObject() for IN parameters and registerOutParameter() and getObject() for OUT
parameters. Here's an example for an IN/OUT parameter:

 MyObject myObj = new MyObject(1234);
 CallableStatement call = conn.prepareCall("{call my_sp(?)}");
 call.registerOutParameter(1, Types.OTHER); // register as OUT parameter
 call.setObject(1, myObj); // set IN parameter
 call.execute(); // do call
 MyObject myResult = (MyObject) call.getObject(1); // get resulting OUT parameter

Signature

Lee Fesperman, FirstSQL, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.