[Looking for Charlie's main web site?]

Determining Your JDBC Driver Version: Pick from 3 ways

Following onto my 2 previous entries related to updating JDBC drivers in CFMX 6 and 7, some readers may appreciate a little more help on the matter of determining just what version of the drivers they do now have installed.

This news has been shared in various blog entries over the past couple of years. I'd like to reprise them here for your edification. Just pay close attention to whether you mean to have them look at CFMX or CFMX 7. They each point to a directory such as C:\CFusionMX\lib or C:\CFusionMX7\lib. Make sure you use the value appropriate to your configuration:

Hope that helps someone as much as it did me.

I found yet a 4th option, some different CFML code offered by Ken Smith on the Adobe CF Admin forums:


When I ran it on CF7, though, it got an error trying to check the MySQL driver. So I modified it with an extra try/ctach to detect such an error. Here is that code with the revision. (There are many other ways the try/catch could have been done. This way works and is good enough to get the answer we need.)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<title>Macromedia Drivers Version</title>


<h2 align="center">DataDirect Driver Listing</h2>
<table border="1" align="center" bordercolordark="black">
<tr bgcolor="#808080"><th>driver</th><th width="100">version</th></tr>
drivernames = "macromedia.jdbc.oracle.OracleDriver, macromedia.jdbc.db2.DB2Driver, macromedia.jdbc.informix.InformixDriver, macromedia.jdbc.sequelink.SequeLinkDriver,macromedia.jdbc.sqlserver.SQLServerDriver, macromedia.jdbc.sybase.SybaseDriver,org.gjt.mm.mysql.Driver,com.mysql.jdbc.Driver";

drivernames=Replace(drivernames," ","","ALL"); //<!--- replace all spaces --->

a_drivernames = ListToArray(drivernames);

len = ArrayLen(a_drivernames);

for (x = 1; x LTE len; x=x+1) {
   try {
      driver = CreateObject("java", a_drivernames[x]);
      writeoutput("<tr><td>&nbsp;" & a_drivernames[x] & "&nbsp;</td> " & "<td align='center'>" & driver.getMajorVersion() & "." & driver.getMinorVersion() & "</td></tr>");
   }catch (Any excpt){
      writeoutput("<tr><td>&nbsp;" & a_drivernames[x] & "&nbsp;</td> " & "<td align='center'>Unavailable</td></tr>");

args= ArrayNew(1);
}catch(Any excpt){}


<h3>Extended version information is output to system out (console or out.log).</h3>


# Posted By Charlie Arehart | 10/30/08 11:49 AM
As an update to this post (from 2006), regarding the command-line example frmo sarge (in a blog post of his from 2005, in the CF7 timeframe), the way to do that as of later releases is just different with respect to the path to where the CF lib folder is. For instance, in CF 2016 on Windows, one can get the SQL Server driver version using this:

java -cp C:\ColdFusion2016\cfusion\lib\macromedia_drivers.jar macromedia.jdbc.sqlserver.SQLServerDriver

And if you get an error that java "is not recognized as an internal or external command", it's simply that you have no "public JRE" on your server, which can be a good thing, security wise. Just replace the java portion of the command above with with c:\ColdFusion2016\jre\bin\java, again on WIndows and for CF 2016, which will point to the jvm installed within CF. So the final version would be:

c:\ColdFusion2016\jre\bin\java -cp C:\ColdFusion2016\cfusion\lib\macromedia_drivers.jar macromedia.jdbc.sqlserver.SQLServerDriver
# Posted By Charlie Arehart | 2/17/16 12:07 PM
Copyright ©2018 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting