java.sql.SQLEception: No suitable drivers found for jdbc: microsoft

advertisements

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)


The connection url should be like this:

DriverManager.getConnection("jdbc:sqlserver://"+.......

Omit the ":microsoft" from the connection string.

Hope this works.