Using db2 10.5 exception while trying to connect to db

825 Views Asked by At

Hi I am unable to connect to database from cmd, there is a problem in establishing a connection. I am using DB2 10.5 version client. Databse is on 10.5 server (Triend with db on 9.7 version server too).

I get the below excpetion :

com.ibm.db2.jcc.am.SqlException: [jcc][4038][12241][3.69.24] T2LUW exception: SQL1042C  An unexpected system error occurred.  SQLSTATE=58004
 ERRORCODE=-1042, SQLSTATE=58004
        at com.ibm.db2.jcc.am.gd.a(Unknown Source)
        at com.ibm.db2.jcc.am.gd.a(Unknown Source)
        at com.ibm.db2.jcc.am.gd.a(Unknown Source)
        at com.ibm.db2.jcc.uw.UWExceptionGenerator.a(Unknown Source)
        at com.ibm.db2.jcc.uw.UWExceptionGenerator.a(Unknown Source)
        at com.ibm.db2.jcc.uw.UWConnection.a(Unknown Source)
        at com.ibm.db2.jcc.uw.f.b(Unknown Source)
        at com.ibm.db2.jcc.uw.UWConnection.a(Unknown Source)
        at com.ibm.db2.jcc.uw.UWConnection.a(Unknown Source)
        at com.ibm.db2.jcc.uw.UWConnection.<init>(Unknown Source)
        at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
        at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
        at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
        at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:171)
        at DBOperation.setConnection(DBOperation.java:38)
        at DBOperation.<init>(DBOperation.java:11)
        at VTLoadStandard.main(VTLoadStandard.java:237)

Please help on resolving the issue.

3

There are 3 best solutions below

0
On

Have a look at the manual entry for this error message.

It may be that your database configuration needs to be upgraded.

Explanation

A system error occurred. Some possible reasons for this error are:

  • The database manager is not installed correctly or the environment is not set up correctly.
  • On UNIX-based systems, db2iupdt may need to be run in order to update the DB2 instance to enable acquisition of a new system configuration or access to function associated with the installation or removal of certain product options, FixPaks, or modification levels.
  • You might get this message if you are not using the correct DB2 Administration Server password.

There is more information about the error at the page I linked above.

0
On

You should check the contents of the DB2 diagnostics log file (db2diag.log) on the server side. The JDBC driver itself usually does not raise errors of such type, so there must be something wrong on the server.

0
On

For me the following helped: make sure you set the driver type 4.

db2datasource.setDriverType(4);
// put driverType=4; into the jdbc url