2
votes

I'm trying to setup my ColdFusion instance to use jTDS for a datasource instead of the built in driver from Macromedia, but when I save the datasource I get the following error:

Connection verification failed for data source: rxdsn
java.sql.SQLException: Timed out trying to establish connection
The root cause was that: java.sql.SQLException: Timed out trying to establish connection

If I create the same datasource with the built in driver I can connect just fine.

I'm doing all of this on ColdFusion 9 Standard on Windows 2008 R2. Here's what I've done so far:

  1. Drop jtds-1.3.0.jar and jcifs-1.3.17.jar into C:\ColdFusion9\lib
  2. Restart ColdFusion (checked ColdFusion sys info page and verified that both are in CF Server Java Class Path)
  3. Created a new datasource with the following information:
    • CF Data Source Name: rxdsn
    • JDBC URL: jdbc:jtds:sqlserver://slavedb:1433/CFOnward1
    • Driver Class: net.sourceforge.jtds.jdbc.Driver
    • Driver Name: jTDS
    • Username: coldfusion
    • Password: *

After I save I get the error. Again, I used the same information (server, database, username and password) with the built in driver and I can successfully connect.

My environment is as follows:

Sever 1:

  • Windows 2008 R2
  • IIS 7.5
  • ColdFusion 9 Standard

Server 2:

  • Windows 2008 R2
  • Microsoft SQL Server 2008 R2 Standard
1
Even though you are specifying username and password for the datasource, have you tried specifying the username and password in the JDBC URL? Something like: jdbc:jtds:sqlserver://slavedb:1433/CFOnward1;user=coldfusion;password=******** You may also need to specify the SQL server instance in the URL. See reference hereMiguel-F
I've tried both of those, as well as combining them. Neither work.Dave Long
Strange... If you are able to connect using the built-in drivers than obviously the ColdFusion server can reach the database server. Try checking the network connections from your ColdFusion server and/or database server when using jTDS. Is it attempting to connect on the correct port? You can use something like netstat -a at a command prompt and look for your database server then verify the port. In my mind the error being reported means that it is unable to reach the database server or the connection is being denied for some reason.Miguel-F
Both drivers use port 1433 and netstat on slavedb tells me that 1433 is the open port.Dave Long
I did try a test script which is as follows which gave me a strange result: writeDump(createObject('java', 'net.sourceforge.jtds.jdbc.Driver')); The result was nothing. The page stopped processing and nothing was outputted.Dave Long

1 Answers

2
votes

I had the same issue today, but after spending some time investigating I have managed to resolve it:

Remove the 1.3.0 version from your coldfusion9/lib folder, and put version 1.2.8 in there, then restart ColdFusion. (I had to try the connection about 5 times after the restart before it connected as it kept on timing out - with a delay this time rather than instantly).

The reason why it fails is because 1.3 is compiled on a newer major version of java compared to the one CF is running.