SQL.INI File Format
Description
The SQL.INI file is used by the BBj interpreter for two purposes:
-
Specifies the JDBC drivers that should be loaded and available to BBj.
-
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:
|
Key Terms
-
JDBC - Java Database Connectivity. JDBC is an API specification that provides a standard interface for accessing databases. It is similar in purpose to ODBC, but its interface is object oriented and similar to some of the ODBC wrapper interfaces such as ADO, DAO, etc.
-
JDBC Driver - A JDBC driver is a Java implementation of the JDBC API for a specific database management system. Each database vendor uses a different JDBC driver, usually developed by the vendor.
-
JDBC Connection String (URL) - This is a connection string that is used to establish a connection to a JDBC data source. The string is referred to as a URL because it describes the location of a JDBC data source. The format of a JDBC connection string is specific to the particular JDBC driver being used.
-
BBj JDBC Driver - This is the implementation of the JDBC API for accessing the BBj Data Server.
Example
Listed below is an example of an SQL.INI file that provides access to a MySQL database from BBj:
|
To open a connection to the MyDatabase data source do the following from a BBj program:
|
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: 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.