IBM Support

For the JDBC driver of SQL Server 2000, the method PreparedStatement.executeUpdate() will always return 0 incorrectly if the corresponding table has a trigger with a Data Definition Language sentence

Troubleshooting


Problem

The Adapter for JDBC can use the JDBC driver released by Microsoft to work with SQL Server 2000. When the adapter needs to update a record in a table within SQL Server 2000, it will call the JDBC API java.sql.PreparedStatement.executeUpdate(). According to the JDBC specification, this method should return the affected row count for the UPDATE statement. In this scenario, the adapter updates just one record, and the returned value should be 1. But we don't find this expected behavior if a trigger has been set up in this table and this trigger includes the DDL call, CREATE TABLE. In this case, the returned value is always 0, not 1. Note that the Create table is for creating a temporary table within the trigger. If we remove this create table call, then the JDBC API call returns 1 properly.

Cause

Confirmed by Microsoft support engineer that this is a defect in the JDBC driver of SQL Server 2000.

Resolving The Problem

This defect has been fixed in the JDBC driver of SQL Server 2005, and the suggestion from Microsoft support is to use this new JDBC driver. You will need to modify the DatabaseURL and JDBCDriverClass settings as below:

DatabaseURL =jdbc:sqlserver://IP:Port;DatabaseName=UserDatabaseName
JDBCDriverClass= com.microsoft.sqlserver.jdbc.SQLServerDriver

[{"Product":{"code":"SSMKUK","label":"WebSphere Adapters Family"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Adapter for JDBC","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"2.6;2.6.1;2.6.2;2.6.3;2.6.4;2.6.5","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
15 June 2018

UID

swg21232426