Using JDBC connector to connect to MySQL 5.0.24 for high encryption

Oct 8, 2006
Since Coldfusion MX 6.1 and 7 don't include the drivers to connect to MySQL version 5, I had to install the latest JDBC drivers from the MySQL site. This also alleviates the problem of being able to use the higher level of encryption MySQL uses for its passwords, that Coldfusions bundled drivers can't handle.

To get the driver, visit the MySQL developer zone and try the latest JDBC driver. In the past, I sometimes have to try different versions, as the latest one doesn't alway work. For my system of MySQL 5.0.24 and Coldfusion 7.0.2, running on Suse Linux 10.0 on an x86 architecture, I used the following driver:
mysql-connector-java-5.0.3
from
http://dev.mysql.com/downloads/connector/j/5.0.html

This was the latest driver I could find at the time of this writing and it worked perfectly.

I found instructions on the Adobe Coldfusion website on how to properly configure the drivers with the Coldufusion Administrator here:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_191708

These Coldfusion instructions refer to 3.1.x releases of the drivers. I didn't try any of these releases, but they might work for you if you have an older version of Coldfusion. For my configuration that I mentioned above, the 5.0.3 drivers worked.

I will reiterate the instructions here (Your file version and name may be different for other versions):
  1. Download the MySQL Connector/J file mysql-connector-java-5.0.3.tar.gz file to a temporary location on your server.
  2. Extract the files and change into the directory:
    # gzip -d mysql-connector-java-5.0.3.tar.gz
    # tar xf mysql-connector-java-5.0.3.tar
    # cd mysql-connector-java-5.0.3/
  3. You will find the following jar file in this directory:
    mysql-connector-java-5.0.3-bin.jar
    This file is the JDBC driver used to connect Coldfusion to MySQL
  4. Copy this file into the Coldfusion lib directory:
    cp mysql-connector-java-5.0.3-bin.jar /opt/coldfusionmx7/wwwroot/WEB-INF/lib/
  5. And restart coldfusion
    /opt/coldfusionmx7/bin/coldfusion stop
    /opt/coldfusionmx7/bin/coldfusion start
  6. Go to the Coldfusion Administrator and the Data & Services -> Data Sources section
  7. Enter the Data Source Name you will be using in your application and choose other for a driver and Add
  8. In the JDBC URL field fill in the following, replacing localhost, 3306 and database with the names of your MySQL server, MySQL port and your database name respectively:
    jdbc:mysql://localhost:3306/database

    For Driver Class enter:
    com.mysql.jdbc.Driver

    For Driver Name, you can enter anything here. I entered the name and version of the driver:
    mysql-connector-java-5.0.3

    And finally, enter the Username and Password used to connect to this database
That should be it. If you have trouble connecting, make sure all the following are ok:
  • The Username and Password to your MySQL server are correct
  • The ip address or hostname and port of you MySQL server are correct
  • Your MySQL server allows access from the Coldfusion server you are connecting from

Comments

New Comment