File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
No Suitable Driver Found
Joined: Oct 25, 2010
Oct 26, 2010 08:20:08
I'm a newbie to Java/JDBC, I'm having trouble connecting to MSSQL Server...hopefully someone can assist:
I downloaded the jtds
driver from Sourceforge.net (type 4 driver)
Key parts of the code follow:
String dbUser = "user1"; String passWord = "passwrd1"; String url = "jdbc:jtds:sqlserver://<dbserver>:<port>/<database_name>" // I also tried replacing "<dbserver>" with the valid ip address and I'm using port 1433 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); // I also tried: Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection(url, dbUser, passWord);
I've also configured the eclipse build path to include all the jars contained in the JDBC
driver zip file (I also tried to configure the build path with just the JDBC driver zip file).
I'm getting following
: No suitable driver found for jdbc:jtds:sqlserver://<ip_address>:<port>/<database_name>
I've exhausted my background and knowledge...can someone please help!!!
Joined: Sep 03, 2005
Oct 26, 2010 08:43:29
Seems like you are doing it right. One small thing though, you do not have to call newInstance after Class.forName.
Here are couple of links that may be helpful for you
Joined: Oct 13, 2005
Oct 26, 2010 09:04:40
Welcome to JavaRanch
Please note the
; since you are new I have edited your post and you can see how much better it looks
It is sorta covered in the
JavaRanch Style Guide
subject: No Suitable Driver Found
sql exception thrown
basic SQL connection steps
do i need odbc to run java applications - reg connection
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015