aspose file tools*
The moose likes JDBC and the fly likes Can I call CallableStatement .getObject(int) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can I call CallableStatement .getObject(int)" Watch "Can I call CallableStatement .getObject(int)" New topic
Author

Can I call CallableStatement .getObject(int)

Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I caught an "SQLException: Invalid column index" from the following code and was wondering whether someone would know can I call CallableStatement.getObject(int) in the first place? (the javadocs don't say anything about not being allowed to call that)

The stack trace looks like this:

Have I understood the meaning of CallableStatement.getObject(int) wrong? Is it supposed to return the parameter set with the corresponding setXXX(int) method or is it supposed to return one of the return values of the stored procedure? If it's the latter, then is there any other way of getting the parameters out of the CallableStatement once they've been set?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
you need to do a registerOutputParameter() first. Post the header of your pl/sql proceedure if that doesn't work (I imagine in/out might be the problem if you already do that).
Simon
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Thanks Simon. Unfortunately I can't use the registerOutParameter(...) method so I'll have to resort to some other means...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I call CallableStatement .getObject(int)
 
Similar Threads
calling stored function
Determine the Callable Statements Parameters at runtime
Internal Error:Invalid index for data access
problem using hibernate and stored procedures for reading portion of data from database
Passing Array as a parameter to Stored procedures