Understanding how a standard JDBC connection is made
A standard JDBC connection is created for you at run time if you are debugging a generated Java program and if the program properties file includes the necessary values. For details on the meaning of the program properties, including details on how the values are derived, see Java run-time properties (details).
The JDBC connection is based on the following kinds of information:
- Connection URL
- If your code tries to access a database before invoking the system function sysLib.connect or sysLib.connectionService, the connection URL is the value of property vgj.jdbc.default.database.
If your code tries to access a database in response to an invocation of the system function sysLib.connect or sysLib.connectionService, the connection URL is the value of property vgj.jdbc.databaseSN.
For details on the format of a connection URL, see sqlValidationConnectionURL.
- User ID
- If your code tries to access a database before invoking the system function sysLib.connect or sysLib.connectionService, the user ID is the value of property vgj.jdbc.default.userid.
If your code tries to access a database in response to an invocation of one of those system functions, the user ID is a value specified in the invocation.
- Password
- If your code tries to access a database before invoking the system function sysLib.connect or sysLib.connectionService, the password is the value of property vgj.jdbc.default.password.
If your code tries to access a database in response to an invocation of one of those system functions, the password is a value specified in the invocation. You can use a system function to avoid exposing the password in the program properties file.
- JDBC driver class
- The JDBC driver class is the value of property vgj.jdbc.drivers.
Related concepts
Program properties file
Related tasks
Setting up a J2EE JDBC connection
Setting up the J2EE run-time environment for EGL-generated code
Related reference
sysLib.connect
sysLib.connectionService
genProperties
Java run-time properties (details)
JDBC driver requirements in EGL
sqlDB
sqlID
sqlPassword
sqlValidationConnectionURL
sqlJDBCDriverClass