I have the above error and am wondering what to do. I have done the following things already:
- downloading the sqljdbc4.jar from Microsofts website
- installing it to my local maven repository
including it in pom.xml like this:
com.microsoft.sqlserver sqljdbc4 4.0
Since I am using jdbc4, I read that I do not have to call Class.forName
, but can build the connection to the database directly.
So why do I still get the nosuitabledriver error?
EDIT: When using ClassForName like below, I get a ClassNotFoundException.
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); //I also tried Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")
String dbURL = "jdbc:sqlserver://localhost;databaseName=test;integratedSecurity=trues";
conn = DriverManager.getConnection(dbURL);