Oct 25
Having just recently decided to start supporting MySQL, I went ahead and setup a new database server and installed MySQL 4.1.13, all seemed to be fine until I actually came to connect ColdFusion to a MySQL database, then Oops.
I got an error something like this
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?
After a fair bit of investigation I discovered that MySQL4.x has changed the way passwords are encrypted. So anything that is using the old method will not connect to your database. This includes the MySQL drivers that come with CFMX as they are 3.x drivers.
You now have two options.
- Set your MySQL server to use the old 3.x style passwords.
- Install a newer MySQL JDBC driver.
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Use old password encryption method
old_passwords
Steps to install a new MySQL 4.x JDBC driver
- Download the MySQL Connector J JDBC driver
- Make the JDBC driver available to CFMX through the classpath by saving mysql-connector-java-3.0-bin.jar in either $CFMX_HOME/runtime/servers/lib/ for CFMX Server Configuration or $JRUN_HOME/servers/lib/ for CFMX on JRun Configuration. This makes the driver available to all JRun server instances.
- Restart CFMX server.
- Add new datasource selecting "other" as the driver
- Add the JDBC URL jdbc:mysql://[server]:[port]/[database]
- Add the Driver Class com.mysql.jdbc.Driver
- Fill in the username/password, and adjust other dsn settings if needed.
- Submit datasource for verification
- As long as the DSN verifies, don't forget to remove the username and password, as you should be passing these in your code.
Aug 19, 2012 at 4:13 AM Well, learning some J2EE is exlacty what I am doing right now (I have a webdeveloping/scripting background, no computer science degree). It helps expanding my horizons even if the vast majority of the apps I build are very far from being enterprise level.I also almost immediately started leveraging Java in CFML for tasks that in the past required COM, CFX or, more in general, were not possible with plain vanilla CFML. I am manipulating images, zip/unzip files, using the DOM in XML, pass parameters to XSLT templates, validating XML files, all exploiting Java in CFML and I plan to do more.While I think complex frameworks like struts, or technologies like EBJ are overkilling for 99% of my own projects, I slowly try to learn a bit about the more sophisticated aspects of J2EE too. I sincerely think that we can all benefit from crosspollination between CF and J2EE