Solving seeming ColdFusion / MySQL 5.6 incompatibility, by updating CF's MySQL driver
Note: This blog post is from 2013. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.If you're running ColdFusion 10 (and perhaps also CF 9 or earlier), you will find that if you update your MySQL installation to version 5.6, you'll get the following error from any SQL you try to run from CFQUERY (and perhaps other CF querying tags, like CFSTOREDPROC):
Summary: There is a reasonable explanation and a rather simple solution: update the MySQL driver that CF is using to at least version 5.1.22 of the driver, the first to support MySQL 5.6, because the one built into CF 10 (driver version 5.1.17) not only does not. More important, that older driver uses something that causes the failure above in 5.6.
That explanation of the "solution" may be enough for some to take the ball and run with it (and if not, I will offer more details on how to do that), though it should be noted that updating the driver is not formally supported, nor is MySQL 5.6 technically supported at all in CF10 (or 9). But for those who will press on knowing that risk, you now know what you need to do.
But as often, there's much more to this than meets the eye, so I hope you will follow along to learn more. I have broken this into two parts:
- the problem (with what I hope is helpful explanation of what the real root of the problem is),
- who's to blame (not Adobe, I will argue)
- and the solution (with some caveats that even experienced folks, or those who don't care about "the problem", should still read.
And again, while I discuss this in the context of CF10, where I've seen the problem happen, it could apply also to CF9 (and it seems reasonable that it would), so all the information still applies, it would seem.
It was also another great example of how things that seem "simple" on the surface have a lot of nuance and subtlety that calls for us all to be more careful in considering various "solutions" offered on the web. It's a frequent source of confusion for many, especially those who come to me when they've exhausted their own searching. :-)
I love to help, and I'm glad we were able to resolve this, and that I was able to share this additional detail for you and others.
We should note that for the Multiserver edition, it would be deep within each instance, such as C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\lib.
@Brian, great to hear that it was helpful. Thanks for sharing the feedback.
I installed HDP2.2/ambari 2.1.1/mysql5.6.27-log
[com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1]
so, I updated MySQL connector -> mysql-connector-java-5.1.32.jar
but I still see smae error log [ You have an error in your SQL syntax; check the ... ....]
how can i solve?
To confirm, go into your CF admin, to the "settings summary" page, and confirm that the jar appears in the classpath.
Report what you find.
PS You start saying that you installed "HDP2.2/ambari 2.1.1/mysql5.6.27-log". Did you really mean to add -log at the end? Are you saying this is an implementation of MySQL? doesn't the hdp refer to Hadoop?
More here (which is about doing it for mysql on CF11 on Unix): http://www.greenvall...
Let me know if that works out.
as a connectionstring value. In the CF DSN advanced settings, you may see such a field, to which you can add it as a value.
Or if you don't see one and have only a JDBC URL, you can append it there.
Here's a doc with some info on that and example values, like EST5EDT. It lists others. It's not a CF-oriented resource, but it doesn't matter, as it shows a JDBC URL using it:
https://knowledgebas...
And if you DO NOT see a JDBC URL field in the CF DSN, add the value instead as a connection string.
Let us know if that gets you going.
Many sources referenced what you were getting at, but I couldn't figure out WHERE I'd enter the connection string in the ColdFusion Admin.
In the Coldfusion 2018 Administrator Data Sources ...under "Advanced" (to which you referred)... was a "Connection String" option. Simply adding something akin to: "serverTimezone=EST5EDT" (or in my case: serverTimezone=CST6CDT) removed the error I was getting and the MySQL data source connected successfully!
Indeed you got me going down the right track.
THANK YOU!!!