Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

No suitable driver found for jdbc:jtds

 
Franklin Wormwood
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi guys, I'm new here. This post is previously in the general java forum I didn't know the jdbc forum exist so I transfered it here.
I have an extremely frustrating problem when using JTDS. According to Marty Hall's
http://www.slideshare.net/martyhall/java-7-programming-tutorial-accessing-databases-with-jdbc
"In Java SE 6.0 and later (JDBC 4.0 and later), the driver is loaded automatically." So I tested my code by removing:

Class.forName("net.sourceforge.jtds.jdbc.Driver");

Now, I created a dynamic web project in eclipse. I first created a class then called the DriverManager.getConnection() method with the microsoft sql server's URL connection, 1433, database, user and password. Then I put the JTDS1.3.1.jar in the lib directory of my project so it should be in the classpath. I ran my project as a java application and it connected successfully. I want to test this in a servlet so I created a servlet then called the method that would connect my project to sql server. But when I run the project this occurs:

java.sql.SQLException: No suitable driver found for jdbc:jtds:sqlserver://localhost:1433`/sample

I'm confused. Why doesn't the JTDS driver run with the server? I'm using jdk8, eclipse kepler, and tomcat 7. I found out JTDS1.3.1 is not jdbc 4.0 compliant but some users in stackoverflow said that if the file "META-INF\services\java.sql.Driver" is inside the jar file the driver will automatically be loaded. I extracted the jar file and the file "META-INF\services\java.sql.Driver" is there. What should I do?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question multiple times. Let's continue the discussion in this duplicate thread.
 
    Bookmark Topic Watch Topic
  • New Topic