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. problem occurred while establishing a connection to SQL Server

problem occurred while establishing a connection to SQL Server

Scheduled Pinned Locked Moved Database
helpsysadmindatabasesql-server
27 Posts 7 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.
  • C Coding C

    Is Remote Connection enabled for your SQL server instance? Goto Configuration Tools >> SQL SErver Surface Area Configuration >> Surface area configuration for services and connections Enable the remote connection by selecting local and remote connection (using both TCP/IP and named pipes) HTH

    Coding C# ExciteTemplate

    J Offline
    J Offline
    janat_Al_donia
    wrote on last edited by
    #3

    thanks for your reply but it didnt work i try it many times before :sigh: do u have any thing else?

    R 1 Reply Last reply
    0
    • J janat_Al_donia

      thanks for your reply but it didnt work i try it many times before :sigh: do u have any thing else?

      R Offline
      R Offline
      r a m e s h
      wrote on last edited by
      #4

      Are you able to connect with SQL Server Management Studio?

      J 1 Reply Last reply
      0
      • R r a m e s h

        Are you able to connect with SQL Server Management Studio?

        J Offline
        J Offline
        janat_Al_donia
        wrote on last edited by
        #5

        yes

        R C 2 Replies Last reply
        0
        • J janat_Al_donia

          yes

          R Offline
          R Offline
          r a m e s h
          wrote on last edited by
          #6

          What type of application did you connect with SQL Server? ASP.NET or Windows application? What type of authentication are you using to connect?

          J 1 Reply Last reply
          0
          • J janat_Al_donia

            yes

            C Offline
            C Offline
            Coding C
            wrote on last edited by
            #7

            Is your connection string correct? Post it

            Coding C# ExciteTemplate

            J 1 Reply Last reply
            0
            • R r a m e s h

              What type of application did you connect with SQL Server? ASP.NET or Windows application? What type of authentication are you using to connect?

              J Offline
              J Offline
              janat_Al_donia
              wrote on last edited by
              #8

              Asp.net and im using mixed mode my code string m = "Data Source=./SQLEXPRESS;AttachDbFilename=C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Data/TestData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; SqlConnection mycon = new SqlConnection(m); mycon.open();

              C R 3 Replies Last reply
              0
              • J janat_Al_donia

                Asp.net and im using mixed mode my code string m = "Data Source=./SQLEXPRESS;AttachDbFilename=C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Data/TestData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; SqlConnection mycon = new SqlConnection(m); mycon.open();

                C Offline
                C Offline
                Coding C
                wrote on last edited by
                #9

                http://www.connectionstrings.com/ This shall help you!!

                Coding C# ExciteTemplate

                1 Reply Last reply
                0
                • J janat_Al_donia

                  Asp.net and im using mixed mode my code string m = "Data Source=./SQLEXPRESS;AttachDbFilename=C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Data/TestData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; SqlConnection mycon = new SqlConnection(m); mycon.open();

                  C Offline
                  C Offline
                  Coding C
                  wrote on last edited by
                  #10

                  You are missing DATABASE name in connection string.

                  Coding C# ExciteTemplate

                  1 Reply Last reply
                  0
                  • C Coding C

                    Is your connection string correct? Post it

                    Coding C# ExciteTemplate

                    J Offline
                    J Offline
                    janat_Al_donia
                    wrote on last edited by
                    #11

                    what is wrong with my connecting string????

                    C 1 Reply Last reply
                    0
                    • J janat_Al_donia

                      what is wrong with my connecting string????

                      C Offline
                      C Offline
                      Coding C
                      wrote on last edited by
                      #12

                      Check the above reply.

                      Coding C# ExciteTemplate

                      J 1 Reply Last reply
                      0
                      • C Coding C

                        Check the above reply.

                        Coding C# ExciteTemplate

                        J Offline
                        J Offline
                        janat_Al_donia
                        wrote on last edited by
                        #13

                        i add database name but it give me the same result :sigh: what is ment by Verify that the instance name is correct ?????

                        C 1 Reply Last reply
                        0
                        • J janat_Al_donia

                          i add database name but it give me the same result :sigh: what is ment by Verify that the instance name is correct ?????

                          C Offline
                          C Offline
                          Coding C
                          wrote on last edited by
                          #14

                          Data Source=./SQLEXPRESS ./SQLEXPRESS This is instance name. Check in your management studio if this is correct. HTH

                          Coding C# ExciteTemplate

                          1 Reply Last reply
                          0
                          • J janat_Al_donia

                            Asp.net and im using mixed mode my code string m = "Data Source=./SQLEXPRESS;AttachDbFilename=C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Data/TestData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; SqlConnection mycon = new SqlConnection(m); mycon.open();

                            R Offline
                            R Offline
                            r a m e s h
                            wrote on last edited by
                            #15

                            So you are using Windows Authentication. ASP.NET application will be running under ASPNET account if you open your site from local IIS. Therefore the ASPNET may not have access to the database. Try to use SQL authentication. Also the database path should look like C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\TestData.mdf. I am not sure ADO.NET will accept / in a path specification.

                            1 Reply Last reply
                            0
                            • J janat_Al_donia

                              hi every body im having a big problem. icant connect to my data base. i have this error A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) i dont know what to do please help me

                              I Offline
                              I Offline
                              i i i
                              wrote on last edited by
                              #16

                              just do the following steps goto StartMenu ---->SqlServer----->Configuration Tools-------->SQL Server Configuration Manager and check in NAMED PIPES protocol is enabled or not :)

                              Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

                              J 1 Reply Last reply
                              0
                              • I i i i

                                just do the following steps goto StartMenu ---->SqlServer----->Configuration Tools-------->SQL Server Configuration Manager and check in NAMED PIPES protocol is enabled or not :)

                                Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

                                J Offline
                                J Offline
                                janat_Al_donia
                                wrote on last edited by
                                #17

                                i enabled it and it suggest to restart sql what to do next????

                                C I 2 Replies Last reply
                                0
                                • J janat_Al_donia

                                  i enabled it and it suggest to restart sql what to do next????

                                  C Offline
                                  C Offline
                                  Coding C
                                  wrote on last edited by
                                  #18

                                  Restart your pc or restart the SQL services. Control Panel > Administrative Tools > Services

                                  Coding C# ExciteTemplate

                                  J I 2 Replies Last reply
                                  0
                                  • C Coding C

                                    Restart your pc or restart the SQL services. Control Panel > Administrative Tools > Services

                                    Coding C# ExciteTemplate

                                    J Offline
                                    J Offline
                                    janat_Al_donia
                                    wrote on last edited by
                                    #19

                                    ops it didnt work ido all thing but the same problem occured

                                    C 1 Reply Last reply
                                    0
                                    • J janat_Al_donia

                                      ops it didnt work ido all thing but the same problem occured

                                      C Offline
                                      C Offline
                                      Coding C
                                      wrote on last edited by
                                      #20

                                      Have you enabled Client Protocol > Named Pipes ?

                                      Coding C# ExciteTemplate

                                      1 Reply Last reply
                                      0
                                      • J janat_Al_donia

                                        hi every body im having a big problem. icant connect to my data base. i have this error A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) i dont know what to do please help me

                                        M Offline
                                        M Offline
                                        Md Marufuzzaman
                                        wrote on last edited by
                                        #21

                                        Do you trying to connect SQL Server via a proxy server... please let me know.

                                        I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.


                                        Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. Thanks Md. Marufuzzaman

                                        1 Reply Last reply
                                        0
                                        • J janat_Al_donia

                                          i enabled it and it suggest to restart sql what to do next????

                                          I Offline
                                          I Offline
                                          i i i
                                          wrote on last edited by
                                          #22

                                          nothing else if you are connecting through Named Pipes then you should enable Named Pipes and if you are connecting through TCP/IP then you should enable your tcp/ip protocol , make sure your SQL Browser is also started....

                                          Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

                                          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