Hello,
I'm trying to connect to DB2 Express-C for Linux using the JDBC
Universal Driver and I get the error below. I thought it was my code
then I installed Websphere Community Edition 1.0.0.1 and I'm now using
the IBM JDK 1.4.2. I wasn't planning to work directly with Websphere
but just wanted to try a different thing and it gives me exactly the
same error when I try to test the connection pool I created (following
"Kick-start your Java apps: Free software, fast development").
I can connect just fine from the command line either using the
'db2inst1' or my own user (which I've enabled through db2cc).
I've the db2jcc.jar and db2jcc_license_cu.jar files in my classpath.
Searching for this error on Google didn't return anything useful so I'm
posting here. Any direction is highly appreciated. I apologise in
advance if this isn't the right group for this kind of question.
Thank you
Error:
com.ibm.db2.jcc.a.DisconnectException: Execution failed due to a
distribution protocol error that caused deallocation of the
conversation. A DRDA Data Stream Syntax Error was detected. Reason:
0x3 DB2ConnectionCorrelator: null
at com.ibm.db2.jcc.c.gb.l(gb.java:1208)
at com.ibm.db2.jcc.c.gb.c(gb.java:363)
at com.ibm.db2.jcc.c.gb.v(gb.java:1441)
at com.ibm.db2.jcc.c.hb.a(hb.java:43)
at com.ibm.db2.jcc.c.b.e(b.java:1253)
at com.ibm.db2.jcc.c.b.b(b.java:1172)
at com.ibm.db2.jcc.c.b.q(b.java:999)
at com.ibm.db2.jcc.c.b.b(b.java:711)
at com.ibm.db2.jcc.c.b.a(b.java:700)
at com.ibm.db2.jcc.c.b.<init>(b.java:315)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:1 65)
at java.sql.DriverManager.getConnection(DriverManager .java:539)
at java.sql.DriverManager.getConnection(DriverManager .java:158)
at HelloWorld.main(HelloWorld.java:24)
Code:
String dbUsername = "myuser";
String dbPassword = "mypasswd";
String dbAlias = "sample";
String url = "jdbc:db2://localhost:50000/" + dbAlias;
Properties dbProperties = new Properties();
dbProperties.setProperty("user",dbUsername);
dbProperties.setProperty("password",dbPassword);
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection db2Conn = DriverManager.getConnection(url, dbProperties);