Articles |
 |
Developer News |
 |
|
|
| Want to receive new articles via e-mail? Click here! |
/Home
/CFML
 |
Connecting a Datasource to MySQL using ColdFusion MX  |
|
|
|
|
Synopsis:
Macromedia calls it a bug. MySQL calls it an updated authentication. We don't care who's right or wrong we just want it to work!!! Here's the fix for your CFMX to MySQL datasource woes.
Note: This fix was performed and tested on a developer workstation. Do not use it in production until you've tested it first! |
|
|
The Article
Problem: Unable to create a datasource using MySQL driver included with CF. This failed on both CFMX 6.1 and CFMX 7 using MySQL 5
Solution: Due to a new authentication code in MySQL you will need to download a new set of MySQL Connector/J database drivers from MySQL.
So here's what I did to get it running on my workstation using the standard server for CFMX7
Uninstalled both CFMX & MySQL Ran RegClean to clean the registry for any possible leftovers.
Fresh Install of CFMX - Configured Normally Fresh Install of MySQL - Configured as Server for WebApps (MyISAM)
Stopped all the CF & MySQL services
Copied the mysql-connector-java-3.1.12-bin.jar from the zip file to...
For Standard CF Server: {CFusionMX path}runtime/servers/lib/mysql-connector-java-3.1.12-bin.jar (http://dev.mysql.com/downloads/connector/j/3.1.htmll) For Standalone Self-Contained Server: {CFusionMX path}/wwwroot/WEB-INF/lib/mysql-connector-java-3.1.12-bin.jar For J2EE Server: J2EE {J2EE path}/servers/lib/mysql-connector-java-3.1.12-bin.jar Note: mysql-connector-java-5.0.0-beta-bin.jar seems to work fine as well, but test it before you go to production (http://dev.mysql.com/downloads/connector/j/5.0.html)
Restarted the stopped services
Added a DSN using "Other" JDBC URL: jdbc:mysql://server:port/dbname Driver Class: com.mysql.jdbc.Driver Driver Name: MySQL 5.0 Username: dbusername Password: dbpassword
Security Note: This was done on my workstation. In a production environment you should never have your db, application services on the same server. DB servers should always live behind a separate firewall.
|
|
|
|
|
|
Sponsors |
 |
|
|
|