Problems accessing a SQL server data source

What kind of problem are you having accessing your SQL Server database?

ERROR CODE: 20001 and SQL STATE: HY000 accessing SQLServer database

The problem might be that the distributed transaction coordinator service is not started. Look for an error similar to the following example when attempting to access an SQL server database:

ERROR CODE: 20001
SQL STATE:  HY000
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]
[SQLServer]xa_open (0) returns -3
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) ...
at com.microsoft.jdbcx.sqlserver.SQLServerDataSource.getXAConnection
(Unknown Source) ...

To confirm this problem:

  1. Go to the Windows Control Panel and click Services(or click Control Panel > Administrative Tools > Services)

  2. Verify whether the service Distributed Transaction Coordinator or DTC is started.

  3. If not, start the Distributed Transaction Coordinator service.

Application fails with message stating "Cannot find stored procedure..." accessing an SQLServer database

This error can occur because the stored procedures for the Java Transaction API (JTA) feature are not installed on the Microsoft SQL Server.

To resolve the problem: Repeat the installation for the stored procedures for the JTA feature, according to the ConnectJDBC installation guide.

Receive the "Cannot find stored procedure" message when using the embedded Connect JDBC driver[V5.1.1 and later]

Symptom When using the embedded Connect JDBC driver to connect to MS SQL Server, the following error occurs:

java.sql.SQLException: [IBM][SQLServer JDBC Driver][SQLServer]Could not find stored procedure 'master..xp_jdbc_open2'.
 at com.ibm.websphere.jdbc.base.BaseExceptions.createException(Unknown Source)
 at com.ibm.websphere.jdbc.base.BaseExceptions.getException(Unknown Source)
 at com.ibm.websphere.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
Problem The version of the Connect JDBC driver embedded in the product requires that you install a newer level of Stored Procedures for JTA on your machine running Microsoft SQL Server.
Description The embedded Connect JDBC driver is shipped with WebSphere Application Server in two parts. The JAR files are included in the main product installation program and are updated automatically when Application Server is updated. However, the Stored Procedures for JTA are found on a CD that is separate from the main installation program. Because the Stored Procedures for JTA must reside on your machines running Microsoft SQL Server, which might be separate from your machines that run WebSphere Application Server, install the stored procedures manually. They cannot be updated automatically when Application Server is updated. Consequently, when you update Application Server, the level of embedded Connect JDBC driver that you install with the fixpack might be inconsistent with your version of Stored Procedures for JTA.
Recommended response The latest supported level of Stored Procedures for JTA for each release of the Connect JDBC driver can be found at the following location: ftp://ftp.software.ibm.com/software/websphere/info/tools/DataDirect/datadirect.htm. Download the required level of Stored Procedures for JTA from this Web site and reinstall the Stored Procedures for JTA on each of your machines running Microsoft SQL Server.

ERROR CODE: SQL5042 when running a Java application

This error can occur when you configure your application to run in the following manner:

  1. you use a type 2 (application) driver running on the gateway to the OS 390

  2. your application is an XA application.

OS 390 does not use XA, but uses SPM. To resolve the problem:

  1. Check your dbm cfg to see that the SPM is not started on the gateway.

  2. Assign a port and set the db2comm variable to TCPIP.

  3. Update the dbm cfg value SPM_NAME to use your machine name.

  4. Start the SPM on the gateway.

After defining a SequeLink data source, you experience a sealing violation either when testing a connection or during run time

This error occurs for JDBC connections that have been configured with the DataDirect SequeLink type 3 JDBC driver for MS SQL Server (XA and non-XA).

Symptom Either when testing a connection or during application run time, you experience a sealing violation similar to the following:

    java.lang.SecurityException: sealing violation: package com.ddtek.jdbc.sequelink is sealed
       at java.net.URLClassLoader.defineClass(URLClassLoader.java:403)
       at java.net.URLClassLoader.access$500(URLClassLoader.java(Inlined Compiled Code))
       at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java(Compiled Code))
       at java.security.AccessController.doPrivileged1(Native Method)
       at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
       at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled Code))
       at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:98)
       at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
       at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
       at java.lang.Class.forName1(Native Method)
       at java.lang.Class.forName(Class.java(Compiled Code))
       at com.ddtek.jdbc.slbase.BaseLicenseUtility.isLocked(Unknown Source)
       at com.ddtek.jdbc.slbase.BaseConnection.open(Unknown Source)
       at com.ddtek.jdbcx.slbase.BaseXADataSource.getBaseConnectionPreparedForXA(Unknown Source)
       at com.ddtek.jdbcx.slbase.BaseXADataSource.getXAConnection(Unknown Source)
Problem WebSphere Application Server embeds its own version of the SequeLink JDBC driver, which is automatically placed on the class path. Both SequeLink JDBC drivers use the same package names, resulting in conflicts when both are on the class path at the same time.
Description The SequeLink JDBC driver declares the com.ddtek.jdbc.sequelink package as sealed in its manifest file. Sealed packages are packages for which all classes must be loaded from the same JAR file. A sealing violation occurs when a Java package is sealed but has classes defined in other JAR files. In this case, because the WebSphere-embedded SequeLink JAR files and those from the DataDirect Technologies SequeLink JDBC driver have the same package names, and these packages are declared as sealed, a sealing violation occurs.
Recommended response The two SequeLink drivers cannot coexist on the class path. To eliminate this scenario, take one of the following actions:

  • Configure your application to use only the WebSphere-embedded SequeLink JDBC driver.

  • Configure your application to use only the DataDirect Technologies SequeLink JDBC driver.

    If you make the second choice, you need to remove the embedded SequeLink JDBC driver from WebSphere Application Server. Uninstalling the embedded driver will keep it out of the class path; you can then use the DataDirect Technologies SequeLink JDBC driver without incurring the sealing error. To remove the embedded SequeLink JDBC driver, stop your appserver and delete the following JARs:

    • %WAS_INSTALL%/lib/sljc.jar

    • %WAS_INSTALL%/lib/spy-sl.jar


Related tasks
Troubleshooting by task: What are you trying to do?
Troubleshooting by component: What is not working?
Example: Accessing data using IBM extended APIs to share connections between container-managed and bean-managed persistence beans
Related reference
Cannot access a data source
Problems accessing an Oracle data source
Problems accessing a DB2 database
Problems accessing a Cloudscape database
Problems accessing a Sybase data source
Data access application programming interface support