Seamless MySQL Connector J 3.x on ColdFusion

I use MySQL 4.1 almost exclusively for my work, and was a little bummed
that neither CF 6.1 nor CF7 support the 3.x Connector J driver for
it.  You can use the old driver, but you run into issues because
the authentication stuff changed between MySQL 4.0 and 4.1, and only
the new 3.x drivers support the new authentication.  Macromedia's
got a technote
about setting up the new driver with CF, but that's still clunky,
because you have to use the "other" database type when setting up your
datasources.  Very clunky and error prone.  However, there's a
simple fix.

Inside the CF install there is a file named
'neo-query.xml'.  Where exactly it is depends on what version of
CF you installed.  In a J2EE install, it's in
/WEB-INF/cfusion/lib.  Within that file is all your configured
datasources, as well as the base information for each database
type.  A simple matter of changing the MySQL type's driver class
to be the one listed in the technote rather than the current value, and
you can again create MySQL datasources using the 'MySQL' datasource
type, and not have to mess with the 'other' type.  All the other
settings can remain the same, though you may want to change the name of
the driver type as well (on CF7 it's "MySQL (3.x)").

Note, the
file is a big-ass one-line WDDX packet, so I'd highly recommend
a decent XML editor, rather than a text editor.  I used XML Buddy
for Eclipse (one piece of my Eclipse toolkit); it's outline view makes
decyphering the WDDX enormously easier.  There are also various
other neo-XXXXX.xml files in that same directory, all filled with other
settings and stuff that can be played around with.  Just be
careful, but if you screw them up, your server might inexplicably stop
working untill you manually undo whatever you did.

10 responses to “Seamless MySQL Connector J 3.x on ColdFusion”

  1. Scott Stroz

    I am still getting the same error, even after implementing your suggested change. Any ideas?

  2. s

    Nevermind…I got it. Thanx for the info.

  3. lucylikes

    Hey 's' – what did you do between 05:34 and 05:42 to resolve it – i still can't get this sucka working!


  4. lucylikes

    woot – i _knew_ that if i posted a comment hewre i would resolve my issue within minutes and lo, that's precisely what happened.

    it works!

    thanks to all


  5. Walker

    Hello, Are the J Connectors faster than the 3.5.1 ODBC connector I have installed? I'm looking for reasons why to upgrade to J Connectors.

    Would it improve Selects and Inserts?

  6. Phil Williams

    OK I've edited my neo-query.xml file so that the MySQL driver class is using com.mysql.jdbc.Driver and restarted CF


    When I add a new MySQL datasource using MySQL as the type it still uses the old driver class as

    It seems that new MySQL datasources added after editing the xml file are being ignored and just using the default. Am I missing something else?

  7. Phil Williams

    Yep it's a legacy thing really as most of my clients are still running on CF7…