Kbase P162414: SQL: Error invoking JAVA stored Procedure that executes the SHOW CATALOGS statement
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  9/13/2010 |
|
Status: Unverified
SYMPTOM(s):
SQL: Error invoking JAVA stored Procedure that executes the SHOW CATALOGS statement
Error "Connection reset ErrorCode=0 SQLState=08S01" calling a Java Stored Procedure from a Java program to get the names of the connected databases under 10.1B03.
Error: "Unexpected SQLException caught SQLState: HY000 Message: [DataDirect][OpenEdge JDBC Driver] Software caused connection abort: recv failed. Error code: 0". calling a Java Stored Procedure from a Java program to get the names of the connected databases under 10.2B.
Error: "Socket closed and Server crash likely" calling a Java Stored Procedure from a WinSQL ODBC client to get the names of the connected databases under 10.1B03.
The Java Stored Procedure executes the SQL statement SHOW CATALOGS ALL but fails to send its Result Set back to the calling ODBC or JDBC client.
Under 10.1B03, the client call causes a memory violation error in the _sqlsrv2.exe process and generates an hs_err_pid.log JVM crash log file that includes:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x4E73E1
Function=tpe_tm_set_level+0xC3BE1
Library=C:\Progress\OpenEdge1B\bin\_sqlsrv2.exe
Current Java thread:
at com.progress.sql.sp.JavaSQL.paramOpen(Native Method)
at com.progress.sql.sp.JavaSQL.open(JavaSQL.java:260)
at com.progress.sql.sp.SQLCursor.open(SQLCursor.java:77)
at YSHANSHI_GETDATABASENAMES_SP.dhSPwrap(YSHANSHI_GETDATABASENAMES_SP.java:27)
at com.progress.sql.sp.JavaBaseSP.dhSPdriver(JavaBaseSP.java:114)
Under 10.2B, the client call causes a memory violation error in the _sqlsrv2.exe process and generates an hs_err_pid.log JVM crash log file with the following header:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x005047c0, pid=1632, tid=3084
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 interpreted mode)
# Problematic frame:
# C [_sqlsrv2.exe+0x1047c0]
#
The script to create the Java Stored Procedure is similar to the following:
DROP PROCEDURE getDatabaseNames;
CREATE PROCEDURE getDatabaseNames()
RESULT (
name CHARACTER(30)
)
BEGIN
String sname = "";
SQLCursor DbCursor = new SQLCursor ("SHOW CATALOGS ALL");
DbCursor.open ();
DbCursor.fetch ();
while (DbCursor.found()) {
sname = (String) DbCursor.getValue(1, CHARACTER);
SQLResultSet.set (1, sname);
SQLResultSet.insert ();
DbCursor.fetch();
}
DbCursor.close ();
END
COMMIT WORK;
The Java class calling the above Java Stored Procedure is similar to the following:
import java.sql.*;
import java.util.*;
import java.io.*;
class getDatabaseNames {
public static void main ( String args[]) {
String driver = "com.ddtek.jdbc.openedge.OpenEdgeDriver";
String dbName = "database1[-mdbq:TwoDatabases]";
String url = "jdbc:datadirect:openedge://PCYSHANSHI2:12345;databaseName=" + dbName + ";" + "SpyAttributes=(log=(file)spy.log;logTName=yes;timestamp=yes)";
String user = "yshanshi";
String passwd = "password";
String cString = "{CALL YSHANSHI.GETDATABASENAMES()}";
Connection con = null;
ResultSet rs = null;
try {
Class.forName(driver);
con = DriverManager.getConnection(url, user, passwd);
CallableStatement cstmt = con.prepareCall(cString);
rs = cstmt.executeQuery();
while (rs.next()) {
System.out.println(rs.getString(1));
}
cstmt.close();
con.close();
}
catch (SQLException ex) {
System.out.println("Unexpected SQLException caught");
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("Message: " + ex.getMessage());
System.out.println("Error code: " + ex.getErrorCode());
ex.printStackTrace();
}
catch (ClassNotFoundException cnfe) {
System.out.println("Unable to instantiate JDBC driver");
}
catch (Throwable excp) {
excp.printStackTrace();
}
}
}
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.x
OpenEdge 10.2x
OpenEdge Category: SQL
CAUSE:
Bug# OE00196491
FIX:
Upgrade to OpenEdge 10.2B02 or later.