Accessibility

TechNote (Archived)

Configuring a JDBC Driver for MySQL 4.1 or 5 for use with ColdFusion MX

Issue


When using the MySQL Driver provided in the list of driver options in the ColdFusion MX Administrator to connect to a MySQL 4.1 or MySQL 5database, the following error may occur:

 Connection verification failed for data source: mysql_bad java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306? The root cause was that: java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306? 

Reason


As of MySQL 4.1, the MySQL database authentication mechanism changed since earlier versions, and older MySQL JDBC drivers will not work unless either MySQL is configured to use the former authentication mechanism or a current version of the driver is used instead.

Solution


To connect to a MySQL 4.1 or 5 database from ColdFusion MX:

  1. Download a current, stable version of the MySQL Connector J JDBC driver, available at: http://dev.mysql.com/downloads/

    Note: Connector/J version 3.1.11 and higher cannot be used with ColdFusion MX 7 because of MySQL bug 13469. Connector/J 3.1.10 should be used instead for ColdFusion MX 7 until this MySQL bug is fixed. All Connector/J version 3.0 releases and all version 3.2 releases work with ColdFusion MX 7.
  2. Extract the mysql-connector-java-3.{n}-bin.jar file from the downloaded archive file.
  3. Save the mysql-connector-java-3.{n}-bin.jar file in thecf_root/WEB-INF/lib directory.
  4. Restart the ColdFusion MX server.
  5. Add a new data source to the ColdFusion MX Administrator, using the driver option Other.
  6. Enter the JDBC URL:
    jdbc:mysql://[host]:[port]/[database]
  7. Enter the Driver Class:
    com.mysql.jdbc.Driver
  8. Complete username/password, and adjust other data source settings, if needed.
  9. Submit the data source for verification.

Additional Information


AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:6ef0253
Database:MySQL

Products Affected:

coldfusion