Reputation: 753
Hello i need to connect my java program to a Microsoft Sql server. I get
java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://LB236:1521;databasename=checkpointDB
I cant not find any problems pleas look at my code and tell me whats wrong.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ properties.getProperty(CP.dbHost.toString())+":"+properties.getProperty(CP.dbPort.toString())+";databasename="+properties.getProperty(CP.dbDatabase.toString()),properties.getProperty(CP.dbUser.toString()),AppDecrypter.getInstance().decrypt(properties.getProperty(CP.dbPassword.toString())));
Full Stack Trace:
java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://LB236:1521;databasename=checkpointDB
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at de.mvn.gotdb_mvn.Importer.openConnection(Importer.java:117)
at de.mvn.gotdb_mvn.Importer.openConnection(Importer.java:135)
at de.mvn.gotdb_mvn.Main.main(Main.java:33)
Upvotes: 0
Views: 913
Reputation: 740
The connection url should be like this:
DriverManager.getConnection("jdbc:sqlserver://"+.......
Omit the ":microsoft" from the connection string.
Hope this works.
Upvotes: 1
Reputation: 990
I think the problem is with the JDBC url you have put.
It should be jdbc:sqlserver://ServerName\sqlexpress.....
Make sure that the sqljdbc jar file which you are using is included in the build path of your project.
Here is a good tutorial for sql server
Upvotes: 1