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. Error in connecting remotely to database

Error in connecting remotely to database

Scheduled Pinned Locked Moved Database
databasehelpcsharpsql-servervisual-studio
10 Posts 4 Posters 1 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.
  • I Offline
    I Offline
    IamAmit
    wrote on last edited by
    #1

    hello friends..I got this error while conecting to sqlsever 2005 through Visual studio 2005 An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) can anyone help me..to resolve it

    T O 2 Replies Last reply
    0
    • I IamAmit

      hello friends..I got this error while conecting to sqlsever 2005 through Visual studio 2005 An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) can anyone help me..to resolve it

      T Offline
      T Offline
      Talal Sultan
      wrote on last edited by
      #2

      I have just suggested here http://www.codeproject.com/script/comments/forums.asp?msg=2175289&forumid=1725#xx2175289xx[^] to check if the machine where the SQL Server is located has any firewall active.

      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

      1 Reply Last reply
      0
      • I IamAmit

        hello friends..I got this error while conecting to sqlsever 2005 through Visual studio 2005 An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) can anyone help me..to resolve it

        O Offline
        O Offline
        originSH
        wrote on last edited by
        #3

        Well read the error message, notice it says

        Amit.Jagtap.nsk wrote:

        this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections

        Do a google search and you'll get plenty of hits http://www.google.co.uk/search?hl=en&q=sql+server+express+enable+remote+connections&meta=[^] pick a likly looking one and work through what it says http://www.datamasker.com/SSE2005_NetworkCfg.htm[^] If your not using Express then say what edition you are using. If you have already enabled remote connections then say so.

        I 1 Reply Last reply
        0
        • O originSH

          Well read the error message, notice it says

          Amit.Jagtap.nsk wrote:

          this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections

          Do a google search and you'll get plenty of hits http://www.google.co.uk/search?hl=en&q=sql+server+express+enable+remote+connections&meta=[^] pick a likly looking one and work through what it says http://www.datamasker.com/SSE2005_NetworkCfg.htm[^] If your not using Express then say what edition you are using. If you have already enabled remote connections then say so.

          I Offline
          I Offline
          IamAmit
          wrote on last edited by
          #4

          Thank you, I tried all these suggestions but still connection is not established..Please Help me

          T 1 Reply Last reply
          0
          • I IamAmit

            Thank you, I tried all these suggestions but still connection is not established..Please Help me

            T Offline
            T Offline
            Talal Sultan
            wrote on last edited by
            #5

            huh...could it be that your server URL is wrong by any remote chance? :)

            -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

            I 1 Reply Last reply
            0
            • T Talal Sultan

              huh...could it be that your server URL is wrong by any remote chance? :)

              -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

              I Offline
              I Offline
              IamAmit
              wrote on last edited by
              #6

              I write connection string as string str="server=pcname/SQLEXPRESS; Initial Catalog=databasename;user=username;password=password "; Is it right. I am using sql server 2005 express edition

              T 1 Reply Last reply
              0
              • I IamAmit

                I write connection string as string str="server=pcname/SQLEXPRESS; Initial Catalog=databasename;user=username;password=password "; Is it right. I am using sql server 2005 express edition

                T Offline
                T Offline
                Talal Sultan
                wrote on last edited by
                #7

                Could you try: "data source=PCName\ServerName;initial catalog=DBName;User ID=Username; Password=Password;" and see what happens?

                -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

                I 1 Reply Last reply
                0
                • T Talal Sultan

                  Could you try: "data source=PCName\ServerName;initial catalog=DBName;User ID=Username; Password=Password;" and see what happens?

                  -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

                  I Offline
                  I Offline
                  IamAmit
                  wrote on last edited by
                  #8

                  I tried it ..But the result is the same...I also allow remote connections through TCP/IP in sql server configuration manager..

                  S 1 Reply Last reply
                  0
                  • I IamAmit

                    I tried it ..But the result is the same...I also allow remote connections through TCP/IP in sql server configuration manager..

                    S Offline
                    S Offline
                    sam
                    wrote on last edited by
                    #9

                    you are using wrong connection string Use this.. Data Source=REMOTE_SQL_SERVER;Network Library=DBMSSOCN;Initial Catalog=MY_DATABASE;User ID=MY_DB_USER;Password=MY_USER_PASSWORD;

                    T 1 Reply Last reply
                    0
                    • S sam

                      you are using wrong connection string Use this.. Data Source=REMOTE_SQL_SERVER;Network Library=DBMSSOCN;Initial Catalog=MY_DATABASE;User ID=MY_DB_USER;Password=MY_USER_PASSWORD;

                      T Offline
                      T Offline
                      Talal Sultan
                      wrote on last edited by
                      #10

                      Well the connection string I gave works perfectly for me. However, it would be interesting to try the SSPI thing: "data source=PCName\DBServerName;initial catalog=DBName;Integrated Security=SSPI"

                      -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

                      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