Forum Discussion

NS189's avatar
NS189
Occasional Contributor
9 years ago
Solved

working with MS SQL using TC11.11

I do not have much experince working with MS SQL using TC and tried to use the ADO class to connect and access the tables, was not able to get very far because I am not able to open the DB, I read couple articles posted on Smartbear, i.e. https://support.smartbear.com/viewarticle/76243/ but still not able to connect to the DB

   here is the code I use :

function dbtst(){

    var dbConn = ADO.CreateConnection();

       dbConn.ConnectionString = "Provider=MSDASQL.1;Driver={SQL Server};Persist Security Info=False;Server=ADDUSCD13248;Database=InstSrv.DB.sql";

 

  dbConn.Open();

}

It fails right at .Open(), it says it requires login, which is true, how do I get to bypass credential checking?

 

thanks

 

  • You cannot 'bypass' security in SQL server. If you login to the SQL server using your Windows credential, the you can use this format of connection string:

     

    Provider=SQLOLEDB;Data Source=Your_Server_Name; Initial Catalog=Your_Database_Name; Integrated Security=true;

     

    If you have different username and password for the SQL server then you can use this format:

     

    "Provider=SQLOLEDB;Data Source=Your_Server_Name; Initial Catalog= Your_Database_Name; UserId=Your_Username; Password=Your_Password;"

1 Reply

  • djadhav's avatar
    djadhav
    Regular Contributor

    You cannot 'bypass' security in SQL server. If you login to the SQL server using your Windows credential, the you can use this format of connection string:

     

    Provider=SQLOLEDB;Data Source=Your_Server_Name; Initial Catalog=Your_Database_Name; Integrated Security=true;

     

    If you have different username and password for the SQL server then you can use this format:

     

    "Provider=SQLOLEDB;Data Source=Your_Server_Name; Initial Catalog= Your_Database_Name; UserId=Your_Username; Password=Your_Password;"