Using JDBC connector to connect to MySQL 5.0.24 for high encryption

Posted Oct 08, 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

Discussions

Comments are currently turned off

Latest Discussions

  • Carlos: Thank you!
    May 16, 2014 | Replies (0)
  • Jessica: Great info, thanks!
    May 15, 2014 | Replies (1)
  • Walter: Thanks, you totally saved me a bunch of searching around just now. I was setting up a percona xtradb...
    Feb 25, 2014 | Replies (0)
  • Avi: I've found the reason of the problem in my case. It's a bug as described here :http://bugs.mysql.com/bug.php?id=68892Shortly:...
    Dec 12, 2013 | Replies (0)
  • Avi: I've also met that behavior twice on 5.6.12 slaves. However, i didn't find the root cause of that....
    Dec 12, 2013 | Replies (0)