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 > JDBC driver connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-05-12, 11:49
antoDb2_user antoDb2_user is offline
Registered User
 
Join Date: Feb 2012
Posts: 2
JDBC driver connection

Hi at all,

A am developing an application that have to connect a DB2 Database system with JDBC driver.
I am using a licensed driver (db2jcc.jar with license jar).

I am able to call simple stored procedure bu i have some problem when i try to invoke a stored procedure that returns a complex out argument.

I have tried with something like this:

Quote:
com.ibm.db2.jcc.DB2SimpleDataSource ds = new com.ibm.db2.jcc.DB2SimpleDataSource();
// set connection properties
ds.setServerName("AC-PC");
ds.setPortNumber(50000);
ds.setDatabaseName("sample");
ds.setDriverType(4);
java.sql.Connection con = ds.getConnection("db2admin", "db2admin");
// execute a query
String query = "CALL DB2ADMIN.TEST('12', ?)";
java.sql.CallableStatement stmt = con.prepareCall(query);
stmt.registerOutParameter (1, Types.STRUCT);
stmt.execute();
but i have the following error:
ERRORCODE=-4228, SQLSTATE=null
This error is raised by following java statement:
Quote:
stmt.registerOutParameter (1, Types.STRUCT);
Is java.sql.Types.STRUCT not supported by IBM Driver?
Reply With Quote
  #2 (permalink)  
Old 02-05-12, 13:09
antoDb2_user antoDb2_user is offline
Registered User
 
Join Date: Feb 2012
Posts: 2
How can i use Types.STRUCT with IBM driver?
Did you ever deal with this kind of problem?

Thanks at all!
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