This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes callable statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "callable statement" Watch "callable statement" New topic
Author

callable statement

ALaxmi Shankaran
Greenhorn

Joined: Feb 23, 2004
Posts: 26
In callable statements what exactly registerOutParameter does?
e.g storedProc.registerOutParameter(1, java.sql.Types.VARCHAR);
Gagan Gulati
Greenhorn

Joined: Jul 27, 2004
Posts: 7
As you are using callable statements over a Stored proc. That stored proc might return some parameters.
To get these parameters in your Java variables, you have to first register these parameters.

-G
Martin Lira
Ranch Hand

Joined: May 26, 2004
Posts: 97
You might need to register a parameter when your stored procedure (stp)returns you some values.
Example: There is a stp called GetNoOfRegisteredUsers{1,2,3}

1 and 2 = IN Parameter like user id and dob
3 = OUT parameter of type java.sql.INTEGER

So you will have to write it like this



Note: If your stored procedure returns a ResultSet it should be read first before doing a stmt.getInt(3). As doing this implicitly closes the ResultSet.

Martin

[ August 19, 2004: Message edited by: Martin Lira ]

[ August 19, 2004: Message edited by: Martin Lira ]
[ August 19, 2004: Message edited by: Martin Lira ]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: callable statement
 
It's not a secret anymore!