Today I ran across an interesting post on cfSearching on how to display the ColdFusion JDBC driver versions on Windows. Knowing this could be useful debugging information, I decided to save the code snippet for future use. However, I quickly released it was targeted directly for ColdFusion MX 7 and also had some hard coded paths that would need to be changed in order to run it on every system.
Since I wanted to be able to run this on any version of ColdFusion, I decided to modify the code a bit so it would work with any version of ColdFusion v6.1 or higher and it shouldn't require changing any of the path information.
Here's my modified version of the code:
This template will display the JDBC information contained in your ColdFusion
v#replace(Server.ColdFusion.ProductVersion, ",", ".", "all")#
<cfset driverInfo = arrayNew(1) >
<cfset pathToJava = Server.ColdFusion.RootDir & "\runtime\jre\bin">
<cfset pathToDriverJar = Server.ColdFusion.RootDir & "\lib\macromedia_drivers.jar">
<cfset 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">
<cfloop list="#driverNames#" index="driver">
arguments="/c #pathToJava#\java -cp #pathToDriverJar# #driver# 2>&1"
<cfset data = structNew()>
<cfset data.class = driver>
<cfset data.version = out>
<cfset arrayAppend(driverInfo, data)>
I also modified the original code to output the version of ColdFusion that's running on the server. Credit goes to cfSearching for the original code.