This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem with callable statement!!!!!!!!!!!!!!!! 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 "Problem with callable statement!!!!!!!!!!!!!!!!" Watch "Problem with callable statement!!!!!!!!!!!!!!!!" New topic
Author

Problem with callable statement!!!!!!!!!!!!!!!!

Jyothsna Sri Y
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
Hi everyone,
I encounter a problem with the registerOutParameter() method while using Callable Statement.
I'm using these procedures to write and retrieve image files to and from a database. the code is as follows:

static String sqlOut=
" begin"+
" insert into pic_store(description,picture)"+
" values(?,empty_blob())"+
" return picture into ?;"+
" end;";
/*code to connect to the database*/
CallableStatement stmt=con.prepareCall(sqlOut);
System.out.println("going to set string "+stmt);
stmt.setString(1,desc);
System.out.println("going to set string "+stmt);
System.out.println("going to register parameters");

stmt.registerOutParameter(2,java.sql.Types.BLOB);

System.out.println("going to execute "+stmt);

The error I'm encountering is:
going to register parameters
java.lang.ArrayIndexOutOfBoundsException
at sun.jdbc.odbc.JdbcOdbcCallableStatement.registerOutParameter(Unknown
Source)
at sun.jdbc.odbc.JdbcOdbcCallableStatement.registerOutParameter(Unknown
Source)
at PicLoader.write(PicLoader.java:87)
at PicLoader.main(PicLoader.java:143)
Can someone tell me where the problem lies?
Thanks.
Regards
Jyothsna.
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
use oracle.jdbc.driver.OracleDriver not odbc!
 
jQuery in Action, 2nd edition
 
subject: Problem with callable statement!!!!!!!!!!!!!!!!
 
Similar Threads
Can I use a Clob as an attribute of a structured type (to map to a Java VO)?
Urgent....
problem with mysql jdbc connection
Problem calling IN parameters Stored Procedure from Java
java.sql.SQLException: Closed Statement