File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jyothsna Sri Y
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 925
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use oracle.jdbc.driver.OracleDriver not odbc!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic