Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to connect to a db2 database in Java. Below the driver and the connection string and the driver details i am giving

Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
String url="jdbc:db2://hostname:portnumber/databasename";
sourceConnection=DriverManager.getConnection(url,"username","password");

But I am getting the below exception

"COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0615E  Error receiving from socket, server is not responding. SQLSTATE=08S01"

I also tried changing the connection string to String url="jdbc:db2:hostname:portnumber/databasename";

Still it is resulting the same exception above while trying to get the Connection.

And i have tried the below option also using JDBC app driver

Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");     
DB2DataSource db2ds = new DB2DataSource();
db2ds.setServerName("hostname");
db2ds.setPortNumber(portnumber);
db2ds.setDatabaseName("databasename");
db2ds.setUser("username");
db2ds.setPassword("password");
sourceConnection=db2ds.getConnection();

For the above two connection I used the jar "db2java.jar"

And i have tried using the JCC driver:

Class.forName("com.ibm.db2.jcc.DB2Driver");
String url="jdbc:db2://hostname:portnumber/databasename";
sourceConnection=DriverManager.getConnection(url,"username","password");

For this connection i have added the below jars 1)db2jcc.jar 2)db2jcc_license_cu.jar

This time around I am getting the below error,

"com.ibm.db2.jcc.am.go: [jcc][t4][201][11237][3.57.82] Connection authorization failure occurred.  
Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000"

I tried to connect to the same db2 source using "Quest for DB2" tool and the connection was successful.

Am i missing something in the code and is it a problem with DB2 drivers or connection string?

Can someone please guide me.

Thanks in advance.

share|improve this question

2 Answers 2

Cause:

If the DB2® instance where InfoSphere Optim Performance Manager is running has the authentication configuration parameter set to DATA_ENCRYPT, you cannot log in to the web console.

Resolving the problem:

Do the following steps:

  1. On the DB2 instance where Optim Performance Manager is running, set the authentication configuration parameter to SERVER by issuing the following command:

    db2 update dbm cfg using authentication server

  2. Restart the DB2 instance and InfoSphere Optim Performance Manager.

For more details visit here.

share|improve this answer

Your first two attempts were not supposed to work. You're using the JCC driver URL format, so it wouldn't be valid for either "net" or "app" drivers, which are deprecated anyway.

Use the JCC driver (com.ibm.db2.jcc.DB2Driver) and the URL format of "jdbc:db2://hostname:portnumber/databasename" and see this technote for the solution to the "Security mechanism not supported" problem. In short, you need to use a supported JDK.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.