I have my Selenium tests written in java (Eclipse). I connect to SQL Server and verify some results in database, using JDBC SQLServerDriver; The tests run perfectly in Eclipse : (Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver).newInstance();
).
While I need to execute them via command line I run the following line:
mvn clean install -Dtest=Test1 test
The test gets executed only until it has to connect SQL Server to verify the data. I get error message that says:
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://DBALIASSTAGING:1433 at java.sql.DriverManager.getConnection(DriverManager.java:689)
I point to JDK 1.8 in Eclipse and in my JAVA_HOME
. I have my sqljdbc4.jar
pointed at in Eclipse and in CLASSPATH
(C:\Microsoft JDBC Driver 4.0\sqljdbc_4.0\enu\sqljdbc4.jar
).
Anything else I am missing? The weird thing is the Test1 runs very well- connects and searches database within Eclipse only. But fails to connect SQL Server via command line, when I run mvn clean install -Dtest=Test1 test
. The run well, but chokes when need to connect to SQL Server (11).
I have read all the posts on sqljdbc4.jar
and set up the CLASSPATH
variable properly and couldn't find anything wrong in my configuration.
Please give me a clue or a hint, I am totally lost, what am I doing wrong?