How Reconnect SQL-Server

  • Dear SQL-Friends

    Is there anyways when sql server gets restart it automaticaly need to get connected with application again

    Syed Sami Ur Rehman
    SQL-DBA
    Creative Technosoft System | www.cts-in.com

  • Connections come from the application, so that's where the code for reconnecting would have to reside.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Like grant said the application has to initiate a new connection , however database mirroring allows your to failover automatically to another server in case the db is down , same thing with clustering too.

    Jayanth Kurup[/url]

  • Thanks (Grant Fritchey,Jayanth_Kurup)

    Its clear that it cant be done using any query or using SSMS rite !

    Thanks for that information, Would i asked you just a small help in this matter

    can you please let me know a basic idea how this can be done via application if you can provide me this details it will be a great favour on me....

    If not never mind thanks for your time guys... 🙂

    Syed Sami Ur Rehman
    SQL-DBA
    Creative Technosoft System | www.cts-in.com

  • Am not sure if this is what your looking for , but most case the connection would have something like

    dbconn.Open()

    and

    dbconn.close()

    if an error is thrown due the the db being offline then the next time the code is exceuted it runs dbconn.open anyway. so the connection is initiated newly.

    A bad practice is to open a single db connection and leave it open for multiple DB calls.

    Also If you cache your connections sometimes an IIS reset is required , but this is dependent on the application.

    Jayanth Kurup[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply