Forum Discussion

VasanthVijay's avatar
VasanthVijay
Contributor
9 years ago

How to check the connection string is active or not?

Hello,

          I have a conneciton string ="Provider=SQLOLEDB.1;Password=*****;Persist Security Info=True;User ID=**;Data Source='*****".

How to Check the Above connection string is active or no?

7 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Vasanth,

     

    Connection string is just a description (metadata) of the parameters and their values required to establish the connection to the database and thus it (connection string) can be neither active nor inactive.

    It is possible to apply the given connection string to some object that is supposed to connect to the database (ADO Connection, ADO Recordset, UDL file, etc.) and try to establish connection. If connection attempt succeeds, this means that the connection string is correct. If you already have an object with applied connection string (e.g. ADO Connection), the object usually has a property or a method (e.g. .Active) that may be used to determine if the connection to the database is open and active or closed.

    Does this help?

    • VasanthVijay's avatar
      VasanthVijay
      Contributor

      Active mean given connection string is to be connected to database and query need to be execute.

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        If you just want to check if this connection string works, you can try to create a test DBTable checkpoint and put your connection string there. Other way is to do this from script. Please read the Working With Databases Using ADO and BDE Objects ( http://smartbear.com/viewarticle/67763/ ) article for details.