aspose file tools*
The moose likes JDBC and the fly likes Cant connect to SQL server with jtds 1.2.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Cant connect to SQL server with jtds 1.2.2" Watch "Cant connect to SQL server with jtds 1.2.2" New topic
Author

Cant connect to SQL server with jtds 1.2.2

Lee Fei Tye
Greenhorn

Joined: Nov 26, 2008
Posts: 12
Hi,

I have this problem where, during development in Eclipse, The database connection has no issues, however when i deploy the updates to the main server, it fails.

Im using tomcat 6.0

I've dump the jtds and mysql drivers to commons lib folder.

I've created the lookup context as below to tomcat config directory


set



When i query the mysql database, it works however when i attempt to query the SQL server database, it catches the exception and return an error which in development environment didn't.

Where did i go wrong? what could possibly be the problem?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

...and what is the error it returns?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Lee Fei Tye
Greenhorn

Joined: Nov 26, 2008
Posts: 12
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'net.sourceforge.jtds.jdbc.Driver'
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So the driver files appear to not be on your classpath.

Are you sure the correct jtds jar file is in the main Tomcat instance's common/lib directory?
Lee Fei Tye
Greenhorn

Joined: Nov 26, 2008
Posts: 12
positive.

its in tomcat/common/library and also public_html/emailregistration/WEB-INF/lib

I've tried putting it else where as well but was not successful.
Lee Fei Tye
Greenhorn

Joined: Nov 26, 2008
Posts: 12
im facing the same problem as discuss in this top: http://forums.sun.com/thread.jspa?threadID=635640

where can i download the commons-jdbc.jar?

cant seem to find it anywhere.
Lee Fei Tye
Greenhorn

Joined: Nov 26, 2008
Posts: 12
Hi, Problem Solved.

What i did was to add

commons-dbcp-1.2.2.jar
commons-pool-1.4.jar
commons-collections-3.2.1.jar - already added initially

to the class path of the application and tomcat

and add factory="org.apache.commons.dbcp.BasicDataSourceFactory" as can be seen below


to the context.

I got the solution thanks to the 2 topics below

http://www.coderanch.com/t/87782/Tomcat/One-resources-defined-context-xml#470239
http://forums.sun.com/thread.jspa?threadID=635640

~Nick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cant connect to SQL server with jtds 1.2.2
 
Similar Threads
see my jsp error dscon$jsp.java [67:1] cannot resolve symbol
Datasource configuration in Tomcat
Is this true: JNDI equals Connection Pooling
Can I bind datasource to java:comp/env/myName JNDI?
Connection pooling in tomcat