tags:

views:

26

answers:

1

I am using the JTOpen JDBC driver to connect to the iSeries (aka AS/400, IBM System-i, IBMi, WTH?!...). I am having problems with a particular statement and it appears I need to go back to the actual SQL job QSQSRVR (or QZDASOINIT?) to find more details. Only problem is that there are hundreds of these on the system. Is there an easy way to determine the job which is actually handling my SQL connection or a particular statement?

+2  A: 

From the JT400 javadoc of the class AS400JDBCConnectionHandle :

getServerJobIdentifier

public String getServerJobIdentifier() throws SQLException

Returns the job identifier of the host server job corresponding to this

connection. Every JDBC connection is associated with a host server job on the system. The format is:

    * 10 character job name
    * 10 character user name
    * 6 character job number 

Note: Since this method is not defined in the JDBC Connection

interface, you typically need to cast a Connection object returned from PooledConnection.getConnection() to an AS400JDBCConnectionHandle in order to call this method:

      String serverJobIdentifier = ((AS400JDBCConnectionHandle)connection).getServerJobIdentifier();


Returns:
    The server job identifier, or null if not known. 
Throws:
    SQLException - If the connection is not open.
svachon
This answer works,
larson4