EGL Reference Guide for iSeries

Setting up a J2EE JDBC connection

If you are connecting to a relational database at run time, follow the directions in the IBM WebSphere Administrator's Console task-oriented help pages, which tell how to define a data source for use with your program. When you define a data source, assign values to the following properties:

Name
Specify a name for your data source.
JNDI name
Specify a value that matches the name to which the database is bound in the JNDI registry:
Database name
Specify the name of your database, as known to the database management system
User ID
Specify the user name for connecting to the database. If the data source definition refers to the default database, the value you specify in the User ID field is overridden by any value set in the vgj.jdbc.default.userid property of the J2EE deployment descriptor used at run time, but only if you have specified values for both vgj.jdbc.default.userid and vgj.jdbc.default.password. Similarly, if the data source definition refers to a database that is accessed by way of the system function sysLib.connect or sysLib.connectionService, the value you specify in the User ID field is overridden by any user ID that you specify in the call to that system function, but only if the call passes both a user ID and password.
Password
Specify the password for connecting to the database. If the data source definition refers to the default database, the value you specify in the Password field is overridden by any value set in the vgj.jdbc.default.password property of the J2EE deployment descriptor used at run time, but only you have specified values for both vgj.jdbc.default.userid and vgj.jdbc.default.password. Similarly, if the data source definition refers to a database that is accessed by way of the system function sysLib.connectionService, the value you specify in the Password field is overridden by any password that you specify in the call to that system function, but only if the call passes both a user ID and password.

You may define multiple data sources, in which case you use the system function sysLib.connectionService to switch between them.

For details on the meaning of the deployment descriptor properties, including details on how the generated values are derived, see Java run-time properties (reference).


Related tasks
Setting up the J2EE run-time environment for EGL-generated code
Understanding how a standard JDBC connection is made


Related reference
sysLib.connectionService
Java run-time properties (details)


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]