IBM Support

Java stored procedures and functions - System naming option

News


Abstract

Java stored procedures and functions - System naming option

Content

You are in: IBM i Technology Updates > Db2 for i - Technology UpdatesDb2 for i Functional Enhancements > Java stored procedures and functions - System naming option

The Native JDBC driver has been enhanced to include a new method to allow the specification of System naming.

This enhancement makes it possible to utilize library list processing (*LIBL) within java procedures and functions.

The method setUseSystemNaming(boolean) can be used to turn system naming mode ON and OFF. To use this method, an appropriate cast of the java.sql.Connection object must be made to the com.ibm.db2.jdbc.DB2Connection class.
A Java stored procedure or user defined function has access to the underlying database through a JDBC connection provided by the native JDBC driver. Because the same environment could be used by different Java stored procedures and user defined functions, the settings used by this JDBC connection are set to the default JDBC settings. There is no way to specify the connection properties to be used with the connection.
NOTE: Before exiting the method, the method should return the connection to the default value. Failure to do so may cause unexpected behavior in other Java stored procedure and Java user defined functions.
Example usage:
-----------------------------------------------------------------------------------------------
Parameter style DB2GENERAL:
-----------------------------------------------------------------------------------------------
DB2Connection connection = (DB2Connection) getConnection();
connection.setUseSystemNaming(true);
....
.... do work using the connection, where system naming should be used
....
connection.setUseSystemNaming(false);
-----------------------------------------------------------------------------------------------
Parameter style JAVA:
-----------------------------------------------------------------------------------------------
DB2Connection connection = (DB2Connection) DriverManager.getConnection("jdbc:default:connection");
connection.setUseSystemNaming(true);
....
.... do work using the connection, where system naming should be used
....
connection.setUseSystemNaming(false);

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
14 January 2020

UID

ibm11167388