Hi,
We are attempting to migrate from SQL Server 2000 to SQL Server 2005. I have several intranet web applications that utilize an older version of i-net’s Opta JDBC jar (Opta2000). However, this jdbc jar is not compatible with SQL Server 2005. I have tested the applications with a trial version of i-net’s Opta Jar (Opta-7.0.3) and the applications work fine, but I am trying to avoid purchasing the commercial jar and make the switch to the jTDS JDBC jar.
I have tested the intranet web applications with the jTDS JDBC jar (versions 1.2 and 1.2.2) and everything works except for scripts we utilize to run SQL DTS Packages.
I am using the PreparedStatement.execute() method to execute the sql scripts which returns multiple results and I continually get an exception thrown when using the jtds jdbc driver. Here is the exception:
java.sql.SQLException: Could not find prepared statement with handle 1.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:475) at com.wachovia.cmg.base.DBCallManager.execute(DBCallManager.java:228) at com.wachovia.cmg.base.DBCallManager.main(DBCallManager.java:515)
I have attached the script (sql_script.txt) we utilize to run the dts packages and get back status of the dts package run. The script may seem complex, but it simply does some pre-checks before setting up the command to run the dts package. To run the dts package we utilize sql server’s xp_cmdshell and the dtsrun utility. The xp_cmdshell returns either a 0 or 1 (0 for success and 1 for failure). After the command is executed, we do some post checks and return status in a resultset.
The exception is thrown during the execution for the script (i.e., when PreparedStatement.execute() is running). Can someone please assist me with this issue? Thanks.
sql script