Pete Freitag Pete Freitag

Checking your JDBC Driver Version

coldfusion

Macromedia recently updated their JDBC driver technote, but I wasn't sure if I already had the 3.3 driver installed (since they may have just updated the text in the technote). So I wrote some code to check what version of the jdbc driver my server was running, and sure enough I needed to update it:

<cfset jdbcDriver = CreateObject("java", "macromedia.jdbc.sqlserver.SQLServerDriver")>
<cfoutput>
#jdbcDriver.getMajorVersion()#.#jdbcDriver.getMinorVersion()#
</cfoutput>

After you install the 3.3 drivers, the result of this code should be "3.3", if it says otherwise, you can update your drivers.


Like this? Follow me ↯

Checking your JDBC Driver Version was first published on March 31, 2004.

If you like reading about jdbc, cfml, cfobject, or java then you might also like:

FuseGuard Web App Firewall for ColdFusion

The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.

Comments

FYI I'm using the java.sql.Driver interface, all jdbc drivers implement this interface.
by Pete Freitag on 03/31/2004 at 4:57:05 PM UTC
How would I be able to get the version of the Oracle Drivers I am using.
by Mario Ciliotta on 04/12/2004 at 9:32:27 AM UTC
The Macromedia Oracle Driver class name is macromedia.jdbc.oracle.OracleDriver just replace that as the second argument of the createObject function. But since the oracle driver is contained in the macromedia_drivers.jar file along with SQL Server, and other drivers you should get the same results. You can replace the class name with any JDBC driver class name, and run this code.
by Pete Freitag on 04/13/2004 at 12:14:32 AM UTC
hi, i cant fix it. i have oracle server in a different ip address and i am using mx. i cant figure out the jdbc url, what is driver class, driver name?
by Mirza H Ahmed on 11/09/2004 at 5:36:00 PM UTC
public static void displayDbProperties(Connection con){
java.sql.DatabaseMetaData dm = null;
java.sql.ResultSet rs = null;
try{

if(con!=null){
dm = con.getMetaData();
System.out.println("\nDriver Information");
System.out.println("\tDriver Name: "+ dm.getDriverName());
System.out.println("\tDriver Version: "+ dm.getDriverVersion ());
System.out.println("\nDatabase Information ");
System.out.println("\tDatabase Name: "+ dm.getDatabaseProductName());
System.out.println("\tDatabase Version: "+ dm.getDatabaseProductVersion());
System.out.println("\tMaximum Connection (If zero--> no limit): "+dm.getMaxConnections());
System.out.println("\tNumeric Functions: "+dm.getNumericFunctions());



System.out.println("Avalilable Catalogs ");
rs = dm.getCatalogs();
while(rs.next()){
System.out.println("\tcatalog: "+ rs.getString(1));
}
rs.close();
rs = null;

}else System.out.println("Error: No active Connection");
}catch(Exception e){
e.printStackTrace();
}
dm=null;
}
}
by Dinesh Pandey on 03/11/2005 at 10:29:48 AM UTC
Thank you for this post! I am sad that I missed the vote although I find this as useful as openemr! Keep up the good work, I am going to refer a few friends to this site I think they could benefit from it. http://www.mmfemr.com
by Shyloh Jacobs on 02/03/2011 at 11:15:09 AM UTC
Thank you for this post! I am sad that I missed the vote although I find this as useful as openemr! Keep up the good work, I am going to refer a few friends to this site I think they could benefit from it.
by Shyloh Jacobs on 02/03/2011 at 11:15:17 AM UTC