databasetestingselenium-webdriverautomationsqljdbc

<java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver> when connecting SQL in background via window scheduler


java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver> When connecting a SQL server through Selenium webdriver(eclipseIDE), running as a background window service(although connection is a success in the foreground)

OS:Window server 2012.... sqljdbc4-2.0.jar path is included in the classpath..... Window Firewall is off..... Running a batch file as a window service which is calling a testng.xml to execute classes.....Even tried by including the sqljdbc4-2.0.jar path in PATH(system environment variable)....


Solution

  • I have just resolved it : the java package should contain all the external libraries. I had a ANT based framework in which all external jars were referred from lib folder(present within the package)

    But there was one jar(sqljdbc4-2.0.jar)for which I gave the reference from some other package, and this created the issue.