18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Trying to connect to SQL Server 2005 - Class not found exception
Hi,
I am trying to connect to sql server 2005 on a remote server but I am getting class not found error. I read the posts related to this issue and tried everything but am still getting the same error. I have added the following text in Sahi.bat file which is in Sahi/Bin folder ;
Set SAHI_EXT_CLASS_PATH=C:/Users/My Folder/SAHI/extlib/db/sqljdbc.jar
I added the sqljdbc.jar, sqljdbc4.jar and sqljdbc_auth.dll files in “C:/Users/My Folder/SAHI/extlib/db” folder.
I am using the following connection string;
var $db = _getDB("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://testserver;databaseName=Users","userName","Passwd");
var $rs = $db.select("select * from users where userid = 20");
_assertEqual("5", $rs[0][“testuser"]);
I am getting the following error;
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.sf.sahi.util.ClassLoadHelper.getClass(ClassLoadHelper.java:23)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:99)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:24
7)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c3._c30(<cmd>:189)
at org.mozilla.javascript.gen.c3.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c4._c2(<cmd>:25)
at org.mozilla.javascript.gen.c4.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java
:108)
11:12:05 AM
I am trying to connect to sql server 2005 on a remote server but I am getting class not found error. I read the posts related to this issue and tried everything but am still getting the same error. I have added the following text in Sahi.bat file which is in Sahi/Bin folder ;
Set SAHI_EXT_CLASS_PATH=C:/Users/My Folder/SAHI/extlib/db/sqljdbc.jar
I added the sqljdbc.jar, sqljdbc4.jar and sqljdbc_auth.dll files in “C:/Users/My Folder/SAHI/extlib/db” folder.
I am using the following connection string;
var $db = _getDB("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://testserver;databaseName=Users","userName","Passwd");
var $rs = $db.select("select * from users where userid = 20");
_assertEqual("5", $rs[0][“testuser"]);
I am getting the following error;
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.sf.sahi.util.ClassLoadHelper.getClass(ClassLoadHelper.java:23)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:99)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:24
7)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c3._c30(<cmd>:189)
at org.mozilla.javascript.gen.c3.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c4._c2(<cmd>:25)
at org.mozilla.javascript.gen.c4.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java
:108)
11:12:05 AM
Comments
If you are running start_sahi.bat then use:
SET SAHI_EXT_CLASS_PATH=%SAHI_HOME%\extlib\db\sqljdbc.jar in start_sahi.bat.
If you are running start_dashboard.bat then use
SET SAHI_EXT_CLASS_PATH=%SAHI_HOME%\extlib\db\sqljdbc.jar in start_dashboard.bat.
Use:
For details of adding jar files to the classpath :
http://sahi.co.in/w/adding-jars-to-sahis-classpath
Regards
Sumitra