Kbase P162141: SQL: DhSQLException object fails to return the developer defined error message text in a new DhSQLEx
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/25/2010 |
|
Status: Verified
SYMPTOM(s):
SQL: DhSQLException object fails to return the developer defined error message text in a new DhSQLException object
In a SQL Java Trigger or a Java Stored Procedure, a new DhSQLException object only returns the the developer defined error code but the developer defined error text.
For example, calling the following Java Stored Procedure:
DROP PROCEDURE Bug;
CREATE PROCEDURE Bug ()
IMPORT
import java.sql.*;
BEGIN
if (true) throw new DhSQLException ( 666 , new String("Sample user defined new DhSQLException object") );
END;
COMMIT WORK;
Returns only the error code 666 but not the error text "Sample user defined new DhSQLException object" as expected:
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=666
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Server Error 666. No message from server.
When calling the above Java Stored Procedure, both the ErrorCode and the error message text (DhSQLException.MESSAGE_TEXT) as follows should be returned:
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=666
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Sample user defined new DhSQLException object
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.1x
OpenEdge 10.1x
OpenEdge 10.2A
OpenEdge 10.2B
CAUSE:
Bug# OE00196697
FIX:
None at this time. As a workaround, use the DhSQLException.err() method to log both the error code and the error message to the sqlnnnn.trc file in the working directory where 'nnnn' is the pid SQL server (_sqlsrv2.exe) process id. For example:
DROP PROCEDURE Fix;
CREATE PROCEDURE Fix ()
IMPORT
import java.sql.*;
BEGIN
if (true) {
DhSQLException excep = new DhSQLException ( 666 , new String("Sample user defined new DhSQLException object") );
excep.err(excep.getDiagnostics(DhSQLException.RETURNED_SQLSTATE));
excep.err("\r");
excep.err(excep.getDiagnostics(DhSQLException.MESSAGE_TEXT));
excep.err("\r");
}
END;
COMMIT WORK;