5 Most Common Data Access Errors in DB2 Database

By | December 28, 2016

5 Most Common Data Access Errors in DB2 Database

Data access is the authority that used to allow to data within a specific database.  The data authority can be granted only by the security administrator of Db2 database. It can be granted to a user, a group or a role. Common people can obtain the data access authority neither directly nor indirectly. However, there are large numbers of error found in db2 database while data access authority is being stayed in action. Let us have a look at some of the most common data access error found in Db2 database and also how to fix these errors manually.

Common Data Access Errors in DB2 Database:

Error #1: “COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource” could not be found for data source (“[data-source-name]“)

 

This error is denoted by message DSRA8040I: Failed to connect to the DataSource.

This error generally takes place when the class path of the DB2 JDBC driver is not set in a correct way to ${DB2_JDBC_DRIVER_PATH}/db2java.zip but the environment variable DB2_JDBC_DRIVER_PATH is not set.

Or, this error can also take place if you are using DB2 Version 7.1 or 7.2 and you have not yet run usejdbc2.This issue can be the reason for having this error even if you have set the correct path.

To confirm this error:

You can go to Manage WebSphere Variable panel. After this, select Environment to verify that there is no entry for the variable DB2_JDBC_DRIVER_PATH.

How to fix this error?

In order to fix this error, you have to add the variable DB2_JDBC_DRIVER_PATH with value equal to the directory path containing the db2java.zip file.

You May Also Like: DB2 SQL ERROR CODES AND SOLUTIONS

Error #2: Error message java.lang.reflect.InvocationTargetException:com.ibm.ws. exception.WsException: DSRA0023E

Error message java.lang.reflect.InvocationTargetException:com.ibm.ws.exception.WsException: DSRA0023E: The DataSource implementation class “COM.ibm.db2.jdbc.DB2XADataSource” could not be found when trying to access a DB2 database

One of the possible reasons for having this error is that a user is trying to use a JDBC 2.0 DataSource, but DB2 is not JDBC 2.0-enabled. This situation frequently takes place with the new installations of Db2 because DB2 provides separate drivers for JDBC 1.X and 2.0, with the same physical file name. JDBC 1.x driver is on the path by default.

To confirm this error:

On Windows system, you have to look for the inuse file in the java12 directory in your DB2 installation root. But, if the file is missing then you are using the JDBC 1.x driver. On operating the systems like AIX® or Linux, you can check the class path for your data source. If the class path does not point to the db2java.zip file in the java12 directory then you are using the JDBC 1.x driver.

How to Fix this error?

On Windows system, stop DB2 and run the usejdbc2.bat file from the java12 directory in your DB2 installation root. After this, run the file from a command line in order to verify that is successfully completed.

Operating system such as Linux or AIX, you can there change the class path for your data source to point to the  db2java.zip file in the java12 directory of your DB2 installation root.

You May Also Like: How to resolve db2 database objects corruption errors

Error #3: SQL0805N Package package-name was not found

SQL0805N Package package-name was not found can be generated if the package name is NULLID.SQLLC300. You can see the SQL0805N Package “NULLID.SQLLC300” was not found. SQLSTATE=51002. for the reason.

How to Fix this error?

In order to fix this error on a DB2 Universal Database (UDB), you can run this one-time procedure with the use of db2cmd interface while connected to the database in question:

  • DB2 bind @db2cli.lst blocking all grant public
  • DB2 bind @db2ubind.lst blocking all grant public

The db2ubind.lst and db2cli.lst files are in the bnd directory of your DB2 installation root. You can run the commands from that directory.

You May Also Like: How to resolve Table Space corruption in DB2 database

Error #4: SQLException, with ErrorCode -99,999 and SQLState 58004, with Java

 

SQLException, with ErrorCode -99,999 and SQLState 58004, with Java “StaleConnectionException: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0119E Unexpected system failure. SQLSTATE=58004″, when using WAS40-type data source.

This system failure generally takes place when you run in XA mode. Or the other possible cause may be:

  • The database name is incorrect.
  • Invalid username or password was provided.
  • Some DB2 packages are corrupted.

If you want to determine whether you have a username or, password issue, then you have to look in them db2diag.log file so that you can view the actual error message and SQL code. If you get an error messages show below then it indicates that you have an invalid username and password.

PID:9086(java)   Appid:*LOCAL.db2inst1.020726191932

2002-07-26-14.19.32.762905   Instance:db2inst1   Node:000

XA DTP Support  sqlxa_open   Probe:101

DIA4701E Database “POLICY2” could not be opened for distributed transaction processing.

String Title: XA Interface SQLCA  PID:9086 Node:000

SQLCODE = -1403

How to Fix this error?

In order to fix this error, you have to correct the username and password. If you specify your password on the GUI for the data source then make sure that the username and password specified by you on the bean are correct. The specified username and password on the bean overwrite whatever you specify when creating the data source.

 

Error #5: CLI0119E System error

If you ever found this error while trying to access a DB2 Universal Database (UDB) data source:

CLI0119E System error.  SQLSTATE=58004 –  DSRA8100 : Unable to get a XAconnection or DSRA0011E:

Exception: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver]

CLI0119E  Unexpected system failure. SQLSTATE=5800

  • On the data source properties page in the administrative console, verify that the correct database name is specified on the data source.
  • On the custom properties page, you can check your username and password custom properties. Verify that they are correct.
  • Make sure that the user ID and password do not contain any blank characters, between, prior to, or after.
  • After this, check that the WAS.policy file exists for the application, as for example, D:\WebSphere\AppServer\installedApps\markSection.ear\META-INF\was.policy.
  • Now simply view the complete exception listing for an underlying SQL error, and then look it up using the DBM vendor message reference.

If you encounter this error while running DB2 on Red Hat Linux, then the max queues system wide parameter is too low to support DB2 while it acquires the essential resources so that it can complete the transaction. When this problem exists, the exceptions J2CA0046E and DSRA0010E can precede the exception DSRA8100E.

How to Fix this Error?

In order to fix this, you can edit the /proc/sys/kernal/msgmni so that you can increase the value of the max queues system wide parameter to a value that is greater than 128.