[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
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