Setting preferences for SQL database connections
You use the page for SQL database connections for these reasons:
- You can enable declaration-time and debug-time access to a database that is accessed outside of J2EE.
- Also, you can set a value for the build descriptor option sqlJNDIName, which specifies a name to which the default datasource is bound in the JNDI registry; for example, java:comp/env/jdbc/MyDB. That option is included in the build descriptor that is created for you in the following situation:
- You use the EGL Web Project Wizard, as described in Creating a project to work with EGL; and
- When working in that wizard, you request that a build descriptor be created.
Do as follows:
- Click Window > Preferences
- When a list of preferences is displayed, expand EGL, then click SQL Database Connections.
- In the Connection URL field, type the URL used to connect to the database through JDBC:
- For IBM DB2 APP DRIVER for Windows, the URL is jdbc:db2:dbName (where dbName is the database name)
- For the Oracle JDBC thin client-side driver, the URL varies by database location. If the database is local to your machine, the URL is jdbc:oracle:thin:dbName (where dbName is the database name). If the database is on a remote server, the URL is jdbc:oracle:thin:@host:port:dbName (where host is the host name of the database server, port is the port number, and dbName is the database name)
- For the Informix JDBC NET driver, the URL is as follows (with the lines combined into one)--
jdbc:informix-sqli://host:port /dbName:informixserver=servername; user=userName;password=passWord
- host
- Name of the machine on which the database server resides
- port
- Port number
- dbName
- Database name
- serverName
- Name of the database server
- userName
- Informix user ID
- passWord
- Password associated with the user ID
- In the Database field, type the name of the database.
- In the User ID field, type the user ID for the connection.
- In the Password field, type the password for the user ID.
- In the Database vendor type field, select the database product and version that you are using for your JDBC connection.
- In the JDBC driver field, select the JDBC driver that you are using for your JDBC connection.
- In the JDBC driver class field, type the driver class for the driver you selected. For IBM DB2 APP DRIVER for Windows, the driver class is COM.ibm.db2.jdbc.app.DB2Driver; for the Oracle JDBC thin client-side driver, the driver class is oracle.jdbc.driver.OracleDriver; and for the Informix JDBC NET driver, the driver class is com.informix.jdbc.IfxDriver. For other driver classes, refer to the documentation for the driver.
- In the class location field, type the fully qualified filename of the *.jar or *.zip file that contains the driver class. For IBM DB2 APP DRIVER for Windows, type the fully qualified filename to the db2java.zip file; for example, d:\sqllib\java\db2java.zip. For the Oracle THIN JDBC DRIVER, type the fully qualified filename to the classes12.zip file; for example, d:\Ora81\jdbc\lib\classes12.zip. For other driver classes, refer to the documentation for the driver.
- In the Connection JNDI name field, specify the database used in J2EE. The value is the name to which the datasource is bound in the JNDI registry; for example, java:comp/env/jdbc/MyDB. As noted earlier, this value is assigned to the option sqlJNDIName in the build descriptor that is constructed automatically for a given EGL Web project.
- If you are accessing DB2 UDB and specify a value in the Secondary authentication ID field, the value is used in the SET CURRENT SQLID statement used by EGL at validation time. The value is case-sensitive.
You can clear or apply preference settings:
- To restore default values, click Restore Defaults.
- To apply preference settings without exiting the preferences dialog, click Apply.
- If you are finished setting preferences, click OK.
Related tasks
Creating an EGL Web project
Setting EGL preferences
Related reference
sqlJNDIName