Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQLConnection Open() throws exception Instance Failure.

SQLConnection Open() throws exception Instance Failure.

Scheduled Pinned Locked Moved Database
csharpdatabasesql-serversysadminhelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MY1201
    wrote on last edited by
    #1

    Hello guys and girls. I'm creating a Windows service with .NET, C# and SQL Server. I have a strange problem with the SQLConnection class. Whenever I choose to call the "Open()" method. It throws an exception with message: "Instance Failure". That's it. Nothing else, just that simple message. :confused: What could be wrong? I've checked the following: - The database server is running. - The computer do have access to the database server (some of my other projects can access the data, and they use the same connection framework as the Windows service). - My user has access to the database. - If I install and run the service on the same computer as the database server, it still doesn't work. Any clues would be appreciated! Thanks in advance! :) /S

    D 1 Reply Last reply
    0
    • M MY1201

      Hello guys and girls. I'm creating a Windows service with .NET, C# and SQL Server. I have a strange problem with the SQLConnection class. Whenever I choose to call the "Open()" method. It throws an exception with message: "Instance Failure". That's it. Nothing else, just that simple message. :confused: What could be wrong? I've checked the following: - The database server is running. - The computer do have access to the database server (some of my other projects can access the data, and they use the same connection framework as the Windows service). - My user has access to the database. - If I install and run the service on the same computer as the database server, it still doesn't work. Any clues would be appreciated! Thanks in advance! :) /S

      D Offline
      D Offline
      dev dhoundiyal
      wrote on last edited by
      #2

      u may need to install sql server service pack 2

      M 1 Reply Last reply
      0
      • D dev dhoundiyal

        u may need to install sql server service pack 2

        M Offline
        M Offline
        MY1201
        wrote on last edited by
        #3

        Perhaps. But I still don't understand, why my other applications, that use the exact same framework, can access the server's data. This makes no sense. Best regards Soeren

        M 1 Reply Last reply
        0
        • M MY1201

          Perhaps. But I still don't understand, why my other applications, that use the exact same framework, can access the server's data. This makes no sense. Best regards Soeren

          M Offline
          M Offline
          MY1201
          wrote on last edited by
          #4

          I have noticed, that the instance failures is caused by an InvalidOperationException, whenever I call the Open() method of the SQLConnection object. But it still makes no sense. Could it be a db permission problem? /Soeren

          M 1 Reply Last reply
          0
          • M MY1201

            I have noticed, that the instance failures is caused by an InvalidOperationException, whenever I call the Open() method of the SQLConnection object. But it still makes no sense. Could it be a db permission problem? /Soeren

            M Offline
            M Offline
            MY1201
            wrote on last edited by
            #5

            Okay. Here is a semi-solution to the problem: It is a permission problem. When the Windows service is running, it uses some obscure username and password to contact the database server. Even though I tell the computer to run the service as a specific user, it still does not work. Then I tried to use SQL authentication instead of integrated security. Now it works. So my conclusion is: Permission problems. If anyone has any idea on how this service/run-as-user-thing works. An explanation would be most helpfull. Thanks in advance. /Soeren

            T 1 Reply Last reply
            0
            • M MY1201

              Okay. Here is a semi-solution to the problem: It is a permission problem. When the Windows service is running, it uses some obscure username and password to contact the database server. Even though I tell the computer to run the service as a specific user, it still does not work. Then I tried to use SQL authentication instead of integrated security. Now it works. So my conclusion is: Permission problems. If anyone has any idea on how this service/run-as-user-thing works. An explanation would be most helpfull. Thanks in advance. /Soeren

              T Offline
              T Offline
              tp team
              wrote on last edited by
              #6

              ANSWER: - check the connection string. If there are any escape chars then make sure you have them correct for the language you are using. VB "Server=mycomputer\myinstance" C# "Server=mycomputer\\myinstance" C# @"Server=mycomputer\myinstance" :-\

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups