SQL.INI File Format

 

The SQL.INI file is used by the BBj interpreter for two purposes:

  1. Specifies the JDBC drivers that should be loaded and available to BBj.

  2. Provides a mapping of data source aliases to their JDBC connection URLs.

The entries in the SQL.INI file provide the information used when a call to SQLOPEN is made from within a BBj program. It is advised that user names and passwords not be included in the connection URL information in the SQL.INI file, but rather, in the MODE= section of the SQLOPEN call.

The location of the SQL.INI file to be used by the BBj program is specified in the config.bbx file as follows:

SQL=/path/to/sql.ini

Example

Listed below is an example of an SQL.INI file that provides access to a MySQL database from BBj:

[JDBC Drivers]
com.mysql.jdbc.Driver

[MyDatabase]
URL=jdbc:mysql://myserver:3306/dbname

 

To open a connection to the MyDatabase data source do the following from a BBj program:

SQLOPEN(1,MODE="user=myname,password=mypassword")"MyDatabase"

For further information on the SQLOPEN command refer to the SQLOPEN Verb - Open SQL Channel topic.

 

[JDBC Drivers] Section

The [JDBC Drivers] section is used to specify a list of all the JDBC drivers that to be loaded and made available to BBj. Each entry should be on a separate line, and consist of the full class name of the JDBC driver's implementation of the java.sql.Driver interface. The third party database product documentation must be consulted to get this information.

IMPORTANT NOTE: Not only must the driver be specified in this section, but the driver's JAR file must be included in the BBj CLASSPATH. The file name can be found by consulting the third party database documentation. To add a new JAR file to the BBj CLASSPATH, please refer to "Java Settings" in Configuring BBjServices via the Enterprise Manager.

Aliases

An alias should be created for each JDBC data source that will be accessed from BBj. This simplifies calls made to SQLOPEN, and makes it possible to change the data source without changing any code in the program.

Aliases are case sensitive, so they must be entered in the SQLOPEN call exactly as they are in the SQL.INI file.

If the data source is a BBj database hosted by the same BBjServices or an ODBC data source, it does not need to be present in the SQL.INI file because it can be opened directly by referring to its case sensitive name in a call to SQLOPEN.