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 SQL Server 2005 database
Hi Team,
I am trying to connect to SQL Server 2005 database. I want to connect to a table present in the database and compare it with my application's newly created item whether it has been actually been stored or not. Firstly, I do not know how to create connection string for SQL Server 2005 which I can use in _getDB() method. Second, I am not able to find jdbcurl which is used as second parameter.
Please Help.
Thank You,
Ashvin.
I am trying to connect to SQL Server 2005 database. I want to connect to a table present in the database and compare it with my application's newly created item whether it has been actually been stored or not. Firstly, I do not know how to create connection string for SQL Server 2005 which I can use in _getDB() method. Second, I am not able to find jdbcurl which is used as second parameter.
Please Help.
Thank You,
Ashvin.
Comments
I have been trying to connect with SQL Server 2005. After extensive search, i found the solution for jdbc druiver and jdbc url which is as follows:
JDBC Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
JDBC URL: jdbc:sqlserver://SERVER_NAME:Port_Name(ideally 1433);databasename=Database_Name;user=Username;password=Password.
Note:This driver and url is server 2005 specific only.
After executing the above details in my script, i got this exception in SAHI tool:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
Searching for possible solution, i found that jar file is required for connecting to SQL Server 2005 which can be found in microsoft site easily. upon, extracting the downloaded exe file, i got the jar file which should be included in SAHI's classpath which i did. But now the tool itself is not working, i mean, controller is repeatedly telling me to do ctrl+alt+DblClick to start the tool again. It also got the following exception:
java.lang.reflect.InvocationTargetException
Now, Im totally confused about how to resolve this problem.
Please Help Me.
Thank You.
i opened sahi.bin file presnt in bin folder. Replaced ..\extlib\rhino\js.jar path with the path of jar file. I have it in the sahi folder.
Can you please paste the full syntax here?
You need to have js.jar also in the path. There is evidently a mistake in the way you have configured the path.
It should look like this: Regards,
Narayan
Default implementation of sahi.bat is as follows:
SET EXT_CLASS_PATH=;
#SET EXT_CLASS_PATH=%EXT_CLASS_PATH%;..\extlib\db\mysql-connector-java-5.0.4-bin.jar
SET SAHI_CLASS_PATH=..\lib\sahi.jar;..\extlib\rhino\js.jar;..\extlib\apc\commons-codec-1.3.jar
SET MOZ_NO_REMOTE=1
java -classpath %EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy
I can see two statements where i can set ext class path; one on first and another in second line. Where should i put my jar file?
I have found workaround for the above post. I have added my jar file in both statements like this:
SET EXT_CLASS_PATH=my\path\to\jar\file.jar;
#SET EXT_CLASS_PATH=%EXT_CLASS_PATH%my\path\to\jar\file.jar
SET SAHI_CLASS_PATH=..\lib\sahi.jar;..\extlib\rhino\js.jar;..\extlib\apc\commons-codec-1.3.jar
SET MOZ_NO_REMOTE=1
java -classpath %EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy
I had no exception while executing and could access 2005 database. But i still think jar path should be included only in one statement. Where???
I have done the changes. Now i can access sql server and without any exception.
Than You very much.