What causes connection error with osql?

  • I am trying to develope a valid database response test for SQL Server (MSSQLSERVER) that would test if we can connect to the database, by doing this:

    osql.exe -Ssvrname -E -ddbname -Q"QUIT"

    if osql returns 0, it passed the resp test

    else, it fails (as it will failed to connect to the database)

    This is assuming the SQL Server is running, and trust connection is used.

    I have the following questions:

    - In what situation, would a connection to the DB fails? e.g. I know it would happen

    when you pause the sql server or when the database is in SUSPECT state.

    - But what else?

    - Are these documented anywhere?

    Thanks.

    Zhigang

  • I am not sure of what else would cause a failure on the SQL side. Networking of course, must be up. If security changes, then that could cause an issue. If the database is suspect, or otherwise down (being restored, etc) it would fail.

    Sorry, don't have a good list.

    Steve Jones

    steve@dkranch.net

Viewing 2 posts - 1 through 1 (of 1 total)

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