my dog learned polymorphism
The moose likes JDBC and the fly likes Can I call CallableStatement .getObject(int) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can I call CallableStatement .getObject(int)
 
Similar Threads
problem using hibernate and stored procedures for reading portion of data from database
Internal Error:Invalid index for data access
Passing Array as a parameter to Stored procedures
calling stored function
Determine the Callable Statements Parameters at runtime