If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > CallableStatement (JDBC) API doesn't support setInt?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-02-10, 17:25
sunny8107 sunny8107 is offline
Registered User
 
Join Date: Mar 2010
Posts: 7
Question CallableStatement (JDBC) API doesn't support setInt?

All,
I am trying to execute a simple DB2 stored procedue. Below is the snippet of the code:

CallableStatement cs3 = con.prepareCall("CALL my_proc5(?, ?)");
System.out.println(cs3.getClass());
cs3.setInt("n1", 3);
cs3.registerOutParameter(2, Types.CHAR);

cs3.execute();
String c2 = cs3.getString(2);
System.out.println("c2: " + c2);
cs3.close();

It keeps complainin the setInt is not supported. This is the error message I get:
Exception in thread "main" com.ibm.db2.jcc.a.SqlException: [jcc][10183][10229][4.0.100] JDBC 3 method called: Method is not yet supported. ERRORCODE=-4450, SQLSTATE=null

I am running using db2jcc4.jar, which according to the docs should support setInt for CallableStatement. The exact driver version (from DatabaseMetaData() is:4.0.100

I have also tried using setObject, but no luck with that. Also when establishing connection, I set the following:
props.put("DB2_USE_DB2JCCT2_JROUTINE", "TRUE");
props.put("driverType", "4");

Still no luck. What am I missing here?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 04-02-10, 21:49
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Try using setInt(int, int) instead of setInt(String, int).
Reply With Quote
  #3 (permalink)  
Old 04-04-10, 23:26
sunny8107 sunny8107 is offline
Registered User
 
Join Date: Mar 2010
Posts: 7
Quote:
Originally Posted by n_i View Post
Try using setInt(int, int) instead of setInt(String, int).
Yes, setInt(int, int) works. Still curious why setInt(String, int) didn't work - eventhough the driver says that it supports the JDBC 4.0 API
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On