18 January 2026:


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.

connection to sql server 2005

kphapakdykphapakdy Members
edited November -1 in Sahi - Open Source
Hi. I'm trying to connect to sql server 2005 to return results from a particular database. I seem to can't get it to work. I've checked through the forum and google searched. Would someone please see if this is correct? Thank you.
var $db = _getDB("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver:CMDTDEVSQL:1433;databaseName=DevSmall_Callminer";"user=kai";"password=change");
   
 $rs = $db.select("select * from SavedSearch");

Comments

  • narayannarayan Administrators
    Hi Kai,

    I think it should be:
    var $db = _getDB("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver:CMDTDEVSQL:1433;databaseName=DevSmall_Callminer;user=kai;password=change", "kai", "change");
       
     $rs = $db.select("select * from SavedSearch");
    

    Regards,
    Narayan
  • kphapakdykphapakdy Members
    edited August 2010
    I ran the above and get playback failure with syntax error. These are the only two lines of code that is currently in my script.
  • kphapakdykphapakdy Members
    edited August 2010
    Narayan,

    The console message that I get when executing. Where can I get the correct driver?


    java.sql.SQLException: No suitable driver found for jdbc:sqlserver:CMDTDEVSQL:14
    33;databaseName=DevSmall_Callminer;user=kai;password=change
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(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:24
    7)
    at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)

    at org.mozilla.javascript.gen.c17._c56(<cmd>:462)
    at org.mozilla.javascript.gen.c17.call(<cmd>)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)

    at org.mozilla.javascript.gen.c18._c0(<cmd>:6)
    at org.mozilla.javascript.gen.c18.call(<cmd>)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:3
    98)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:306
    5)
    at org.mozilla.javascript.gen.c18.call(<cmd>)
    at org.mozilla.javascript.gen.c18.exec(<cmd>)
    at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
    at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:93)
    at java.lang.Thread.run(Unknown Source)
  • sql 2005

    String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=sample";

    i think // is need before machine name
Sign In or Register to comment.