Search code examples
jdbccoldfusionsybasecoldfusion-9

How can I install the Sybase JDBC driver for ColdFusion?


I just want to ask for some help regarding the JDBC driver and configuring a ColdFusion datasource. After I save, by clicking the submit button, it generates this error:

Connection verification failed for data source: mydtsrcName java.sql.SQLException: No suitable driver found for jdbc:jtds:sybase://127.0.0.1:1313/test.db The root cause was that: java.sql.SQLException: No suitable driver found for jdbc:jtds:sybase://127.0.0.1:1313/test.db

Can anyone explain the problem? How can I install the JDBC driver in ColdFusion?

Here are the settings for the DSN that I configured in the ColdFusion Administrator:

 CF Data Source : my_dtsrc
 JDBC URL       : jdbc:sybase:Tds:127.0.0.1:3939
 Driver Class   : com.sybase.jdbc3.jdbc.SybDriver
 Driver Name    : SybDriver
 User name      : myusername
 Password       : mypwd

Did I miss something ?


Solution

  • (Extended from comments ...)

    Did you add the driver jar to the CF class path and restart the CF server first? When the CF server starts, it only checks specific locations for jars/classes. Collectively, those locations are referred to as the "CF class path". Your driver jar must be placed somewhere within the CF class path, or it will not be detected. Hence the error message "No suitable driver found".

    There are several locations CF checks automatically when it starts, such as:

    • {cf_root}\lib
    • {cf_root}\WEB-INF\lib

    The simplest option is to just drop your jar in one of those directories. Then restart the service so CF detects the jar. Afterward, CF will be able to locate the driver class and you can create your "Other" datasource. (Note, the driver class name is case-sensitive)

    NB: Technically you can place a jar anywhere, as long as it is accessible to the CF server and you add it to the class path in jvm.config. (See this blog entry for details. It is old, but still relevant). But again, it is simpler to just drop it in one of the directories CF checks automatically. Then there is no need to muck around with the jvm.config file.