Data access problems for Apache Derby databases
Use troubleshooting tips for help accessing Apache Derby databases.
What problem are you having accessing your Apache Derby database?
- Unexpected IOException wrapped in SQLException, accessing Apache Derby database
- The "select for update" operation causes table lock and deadlock when accessing Apache Derby
- Error "The version of the IBM Universal JDBC driver in use is not licensed for connectivity to Apache Derby databases"
- Run an application causes a runtime exception which produces an unreadable message
Apache Derby errorCodes 2000, 3000, and 4000, indicate levels of severity, not specific error conditions. In diagnosing Apache Derby problems, pay attention to the given sqlState value.
Unexpected IOException wrapped in SQLException, accessing Apache Derby database
This problem can occur because Apache Derby databases use many files. Some operating systems, such as the Solaris Operating Environment, limit the number of files an application can open at one time. If the default is a low number, such as 64, we can get this exception.
If we can configure the number of file descriptors on the operating system, we can correct the problem by setting the number to a high value, such as 1024.
The "select for update" operation causes table lock and deadlock when accessing Apache Derby
If a select for update operation on one row locks the entire table, which creates a deadlock condition, there might be undefined indexes on that table. The lack of an index on the columns we use in the where clause can cause Apache Derby to create a table lock rather than a row level lock.
To resolve this problem, create an index on the affected table.
Error "The version of the IBM Universal JDBC driver in use is not licensed for connectivity to Apache Derby databases"
At the client run time, an error similar to the following occurs:
The version of the IBM Universal JDBC driver in use is not licensed for connectivity to Apache Derby databases. To connect to this DB2 server, please obtain a licensed copy of the IBM DB2 Universal Driver for JDBC and SQLJ. An appropriate license file db2jcc_license_*.jar for this target platform must be installed to the application classpath. Connectivity to Apache Derby databases is enabled by any of the following license files: { db2jcc_license_c.jar, b2jcc_license_cu.jar, db2jcc_license_cisuz.jar }The problem occurs because an incorrect JDBC driver JAR file name is specified in the class path for JDBC provider. For example, the JAR file name might have an extra '_', as follows:${UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license__cu.jarTo resolve the problem:
- Correct the UNIVERSAL_JDBC_DRIVER_PATH JAR file name in the JACL script.
- Restart the cluster.
- Rerun the client.
Running an application causes a runtime exception which produces an unreadable message
At client run time, we might receive a message similar to the following: Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42X05, SQLERRMC: ANNUITYHOLDER20^T42X05
The problem occurs because the property retrieveMessagesfromServerOnGetMessage, which is required by WebSphere Application Server, has not been set.
To resolve the problem, on the administrative console
- Click Resources > JDBC Providers.
- Click an Apache Derby provider
- Scroll down and click Data Sources.
- Select the data source or add a new one.
- Select Custom Properties.
- If the property, retrieveMessagesFromServerOnGetMessage exists, set its value to true. If the property does not exist, select New and add the property, retrieveMessagesFromServerOnGetMessage with a value true.
- Rerun the client.
The SystemOut.log now generates readable messages so that we can resolve the underlying problem.
IBM recommends using the High Performance Extensible Logging (HPEL) log and trace infrastructure . We view HPEL log and trace information using the logViewer .
Related:
Troubleshoot and support Developing data access applications Use High Performance Extensible Logging to troubleshoot applications Data access problems Data access problems for Oracle data sources Data access problems for DB2 databases Data access problems for Microsoft SQL Server data sources Data access problems for Sybase data sources