I’m attempting to use a 3rd party JDBC driver with my Coldfusion installation, but I’ve gone wrong somewhere, and I’m not exactly certain where.
I placed the .jar file inside of cfusion\wwwroot as well as WEB-INF\lib, but did not add it to my Datasources, as I’m not exactly certain if I have to/how I would since it is a local file.
Then, inside my test.cfm file I added the following code:
<cfset objDriver = createObject("java","java.sql.DriverManager")>
<cfset prop = createObject("java","java.util.Properties").init()>
<cfset prop.put("prop1", "prop1")>
<cfset prop.put("prop2", "prop2")>
<cfset prop.put("prop3", "prop3")>
<cfset conn = objDriver.getConnection("jdbc:mydriver:", prop) >
I verified that the properties and connection work fine in Java, so this is not the issue persay, but when I go to the page I get the following error on getConnection():
No suitable driver found for jdbc:mydriver:
I was wondering if I missed something obvious or silly.
I would add it to the datasources instead. Otherwise you are going to end up writing ugly Java code to “get around” the driver.
To add to the DSN’s use the “other” datasource and add a “connection string”. These are specifica to the driver and you should have some samples associated with the driver you have downloaded. They serve as a good starting point.
You can see strings from other datasources you have added by examining the “neo-datasources.xml” file in the /lib directory of your CF install.
You will need to insure the driver is in the /lib directory of the CF install (not the same as WEB-INF/Lib) on older version of CF – not sure about CF 10. You also need to restart CF after putting it in the directory.
alternately you can add the file to the classpath by editing the jvm config file.