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.
How to connect to a Microsoft SQL Server 2005?
Hi,
i want to connect to a Microsoft SQL Server 2005 and it always fails
Versions installed:
Java Runtime Environment 6.0_18
Sahi 2010-02-08
Microsoft SQL Server JDBC Driver 2.0: sqljdbc4.jar (supplies JDBC 4.0, necessary for Java Runtime Environment 6)
My script looks like:
var $db = _getDB("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://server:port;databaseName=myDatabase", "user", "password");
var $result = $db.select("select * from table");
_alert($result);
Annotation: I also tried SELECT COUNT * and SELECT ... WHERE. So there aren't returned too many results ...
I tried several things in sahi.bat:
1)
set SAHI_CLASS_PATH=%SAHI_HOME%\lib\sahi.jar;%SAHI_HOME%\extlib\rhino\js.jar;%SAHI_HOME%\extlib\apc\commons-codec-1.3.jar;SAHI_HOME%\extlib\mssql\sqljdbc4.jar
2)
the following setting don't exist in the original file, therefore I added this line below "set SAHI_CLASS_PATH=: ..."
SET SAHI_EXT_CLASS_PATH=c:\sahi\extlib\mssql\sqljdbc4.jar;
3)
java -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
java -classpath c:\sahi\extlib\mssql\sqljdbc4.jar;../lib/sahi.jar net.sf.sahi.
... but I always get the same error:
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1355)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1532)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:1133)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1054)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
at java.sql.DriverManager.get Connechtion(Unknown Source)
at java.sql.DriverManager.get Connechtion(Unknown Source)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:96)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:79)
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:247)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c1._c53(<cmd>:439)
at org.mozilla.javascript.gen.c1.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c2._c0(<cmd>:3)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.gen.c2.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:86)
at java.lang.Thread.run(Unknown Source)
Do you know, what goes wrong?
I read in another post about DB2, that a semicolon(;) in the connection string caused trouble ...
Can you please help?
Regards,
Sniper
i want to connect to a Microsoft SQL Server 2005 and it always fails
Versions installed:
Java Runtime Environment 6.0_18
Sahi 2010-02-08
Microsoft SQL Server JDBC Driver 2.0: sqljdbc4.jar (supplies JDBC 4.0, necessary for Java Runtime Environment 6)
My script looks like:
var $db = _getDB("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://server:port;databaseName=myDatabase", "user", "password");
var $result = $db.select("select * from table");
_alert($result);
Annotation: I also tried SELECT COUNT * and SELECT ... WHERE. So there aren't returned too many results ...
I tried several things in sahi.bat:
1)
set SAHI_CLASS_PATH=%SAHI_HOME%\lib\sahi.jar;%SAHI_HOME%\extlib\rhino\js.jar;%SAHI_HOME%\extlib\apc\commons-codec-1.3.jar;SAHI_HOME%\extlib\mssql\sqljdbc4.jar
2)
the following setting don't exist in the original file, therefore I added this line below "set SAHI_CLASS_PATH=: ..."
SET SAHI_EXT_CLASS_PATH=c:\sahi\extlib\mssql\sqljdbc4.jar;
3)
java -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
java -classpath c:\sahi\extlib\mssql\sqljdbc4.jar;../lib/sahi.jar net.sf.sahi.
... but I always get the same error:
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1355)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1532)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:1133)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1054)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
at java.sql.DriverManager.get Connechtion(Unknown Source)
at java.sql.DriverManager.get Connechtion(Unknown Source)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:96)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:79)
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:247)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c1._c53(<cmd>:439)
at org.mozilla.javascript.gen.c1.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c2._c0(<cmd>:3)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.gen.c2.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:86)
at java.lang.Thread.run(Unknown Source)
Do you know, what goes wrong?
I read in another post about DB2, that a semicolon(;) in the connection string caused trouble ...
Can you please help?
Regards,
Sniper