Consultor Eletrônico



Kbase P162139: SQL: How to use the DhSQLException.err() in a Java Stored Procedure or Java database trigger?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/25/2010
Status: Verified

GOAL:

SQL: How to use the DhSQLException.err() method in a Java Stored Procedure or a Java database trigger?

GOAL:

Are the DhSQLException.err() and DhSQLException.log() methods referenced in the SQL documentation accessible to developers?

GOAL:

How to log customized error messages from inside a Java Stored Procedure or a Java database trigger?

GOAL:

What is the number NNNN in the sqlNNNN.trc file name indicate and where is this file located?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

The DhSQLException.log() method is not currently exposed to developers. The DhSQLException.err() is exposed to developers and is used to log developer custom error messages to the sqlNNNN.trc file.
The sqlNNNN.trc is located in the server process working directory and the number NNNN in its name indicate the PID of the _sqlsrv2.exe server process .
The following steps demonstrate how to use the DhSQLException.err() method to log developer custom error messages from inside a Java Stored Procedure into the sqlNNNN.trc file.
These steps use the sports2000 demo database and reference several files, mostly one line commands, attached in the notes at the bottom of this solution:
1. Log onto a Windows machine that has OpenEdge 10.1x or OpenEdge 10.2x installed on it.
2. Copy the files attached at the bottom of this solution and save them in your OpenEdge working directory.
a. Fix.sql - Script to create the Stored Procedure.
b. Fix.bat - Command to create the Stored Procedure.
c. CallFix.sql - Script to CALL the Stored Procedure.
d. CallFix.bat - Command to CALL the Stored Procedure.
e. DBStart.bat - Command to start the database.
3. Edit the Fix.bat and the CallFix.bat files to reflect your own DATABASE NAME, HOST NAME, PORT NUMBER, USERID and PASSWORD.
4. Start a proenv session:
Start > Programs > OpenEdge > Proenv
5. Create a copy of the sports2000 database in your default working directory:
prodb sports2000 sports2000
6. Start the sports2000 database:
DBStart.bat
7. Create the Stored Procedure:
Fix.bat
8. Call the Stored Procedure:
CallFix.bat
9. Display the sqlNNNN.trc file. (Edit the following command to reference the actual name of the sqlNNNN.trc file generated in your working directory):
notepad sqlNNNN.trc
10. Observe that both the developer defined error number and error message are logged in the sqlNNNN.trc .