United States Argentina Australia Austria Belgium Canada Chile Colombia Costa Rica Dominican Republic France Germany Bangladesh/India Italy Kenya Mexico Netherlands Puerto Rico South Africa Sweden Switzerland Venezuela
BASIS International Ltd.
Home | Site Map | Contact Us | Partner Login  

 













BASIS Knowledge Base Article #01055

Title:

How to configure MySQL JDBC for use by BBj

Description:

Download the MySQL Connector/J from MySQL.

Unzip/untar this per the MySQL instructions. Next make the .jar file visible to BBj. Go into the BBj Enterprise Manager and open up the Java Settings dialog. Add the path to the mysql-connector-java-[version]-bin.jar file to the BBj classpath.

Stop and restart BBj Services.

Add the following line to your SQL.ini file:

[JDBC Drivers]
com.mysql.jdbc.Driver

This will load the driver into memory when a BBj interpreter session starts.

Next add an entry to the SQL.ini file as an alias to your database. You will need to construct a JDBC connection string. The JDBC URL format for MySQL Connector/J is as follows, with items in square brackets ([, ]) being optional:

jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...

If the hostname is not specified, it defaults to '127.0.0.1'. If the port is not specified, it defaults to '3306', the default port number for MySQL servers.

Starting with version 3.0.12 and 3.1.2, Connector/J supports multiple hosts with ports, separated by commas:

jdbc:mysql://[host:port],[host:port].../[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...

For example, if you have a database called "mydata" on the local machine, add the following to the SQL.ini file:

[MyDatabase]
URL=jdbc:mysql://localhost/mydata

Here is a sample to access the MySQL data base in your BBj code:

SQLOPEN(1, mode="UID=myname,PWD=mypass") "MyDatabase"



Last Modified: 07/07/2004
Product: BBj