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. Connection string for database on another comouter

Connection string for database on another comouter

Scheduled Pinned Locked Moved Database
csharpdatabaselinqsysadminsecurity
10 Posts 2 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.
  • W Offline
    W Offline
    wjbjnr
    wrote on last edited by
    #1

    HI. I am currently working on a database application. I use Sql express studio to model the database and then use LINQ in c# to access it. Whereas everything is great , the thing is that the database is on the same laptop where there is the application to access it. Let say this laptop name is "A". i use the connection string connString = @"server = .\sqlexpress;integrated security = true;database = Whatever"; (YES i am using Winodws authenciation) But if i want to access database on a different Laptop from the application running on "A", what will be the connection string?? I will connect the Both Laptops through their own WIFI.

    W 1 Reply Last reply
    0
    • W wjbjnr

      HI. I am currently working on a database application. I use Sql express studio to model the database and then use LINQ in c# to access it. Whereas everything is great , the thing is that the database is on the same laptop where there is the application to access it. Let say this laptop name is "A". i use the connection string connString = @"server = .\sqlexpress;integrated security = true;database = Whatever"; (YES i am using Winodws authenciation) But if i want to access database on a different Laptop from the application running on "A", what will be the connection string?? I will connect the Both Laptops through their own WIFI.

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      When connecting to remote database you replace the server name. Currently you use dot to tell that the server is local. In case of remote server you would have a connection string like:

      server=servername\instancename;integrated security...

      Have a look at this site: http://www.connectionstrings.com/sql-server-2005[^]

      The need to optimize rises from a bad design.My articles[^]

      W 1 Reply Last reply
      0
      • W Wendelius

        When connecting to remote database you replace the server name. Currently you use dot to tell that the server is local. In case of remote server you would have a connection string like:

        server=servername\instancename;integrated security...

        Have a look at this site: http://www.connectionstrings.com/sql-server-2005[^]

        The need to optimize rises from a bad design.My articles[^]

        W Offline
        W Offline
        wjbjnr
        wrote on last edited by
        #3

        I guess i have to use one of the connection string mentioned:- someting like. Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword; I want to know . how to know ip of one computer?? what is network library?? and i am using sql express studio 2008 r2 on both computers. So where is the keyword /sqlexpress is to be used?

        W 1 Reply Last reply
        0
        • W wjbjnr

          I guess i have to use one of the connection string mentioned:- someting like. Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword; I want to know . how to know ip of one computer?? what is network library?? and i am using sql express studio 2008 r2 on both computers. So where is the keyword /sqlexpress is to be used?

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          You don't have to know the IP address, you can use names instead. \SQLEXPRESS isn't a keyword, it's the name of the SQL Server instance. For example if I have a server called Machine1 and I have two different instances of SQL Server in that server; Production and Test. Now if I want to connect to the Test-instance of SQL Server, I'd use a connection string like:

          Data Source=Machine1\Test;...

          Perhaps the easiest way to see locally the name of the instance is to open Control Panel and look at services. The instance name is in parenthesis on the service name.

          The need to optimize rises from a bad design.My articles[^]

          W 1 Reply Last reply
          0
          • W Wendelius

            You don't have to know the IP address, you can use names instead. \SQLEXPRESS isn't a keyword, it's the name of the SQL Server instance. For example if I have a server called Machine1 and I have two different instances of SQL Server in that server; Production and Test. Now if I want to connect to the Test-instance of SQL Server, I'd use a connection string like:

            Data Source=Machine1\Test;...

            Perhaps the easiest way to see locally the name of the instance is to open Control Panel and look at services. The instance name is in parenthesis on the service name.

            The need to optimize rises from a bad design.My articles[^]

            W Offline
            W Offline
            wjbjnr
            wrote on last edited by
            #5

            oh ok..i am getting it.. so my final connection string will look something like this ? server=computername\instancename ; integrated security = false ; database = "whatever" ; user id = sa ; Password=pass;

            W 1 Reply Last reply
            0
            • W wjbjnr

              oh ok..i am getting it.. so my final connection string will look something like this ? server=computername\instancename ; integrated security = false ; database = "whatever" ; user id = sa ; Password=pass;

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              Exactly :)

              The need to optimize rises from a bad design.My articles[^]

              W 1 Reply Last reply
              0
              • W Wendelius

                Exactly :)

                The need to optimize rises from a bad design.My articles[^]

                W Offline
                W Offline
                wjbjnr
                wrote on last edited by
                #7

                I am trying to do it from a different laptop , which is on the same network... But it gives error when i try to connect through sql express studio....... error 26 A network or instance-specific error occured while esablishing a connection to sql server..it might be not found or accesible................is there any other setting i am missing??? and how to make sure that both computers are properly connected over the network?

                W 1 Reply Last reply
                0
                • W wjbjnr

                  I am trying to do it from a different laptop , which is on the same network... But it gives error when i try to connect through sql express studio....... error 26 A network or instance-specific error occured while esablishing a connection to sql server..it might be not found or accesible................is there any other setting i am missing??? and how to make sure that both computers are properly connected over the network?

                  W Offline
                  W Offline
                  Wendelius
                  wrote on last edited by
                  #8

                  There are several possibilities. First try to ping the other machine with the name you have specified in the connection string. If that's ok, check the firewall settings on both ends (you can disable Windows firewall for a while just to test the connection) etc. Here's one quite good walkthrough for SQL Server 2005: http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/[^]

                  The need to optimize rises from a bad design.My articles[^]

                  W 1 Reply Last reply
                  0
                  • W Wendelius

                    There are several possibilities. First try to ping the other machine with the name you have specified in the connection string. If that's ok, check the firewall settings on both ends (you can disable Windows firewall for a while just to test the connection) etc. Here's one quite good walkthrough for SQL Server 2005: http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/[^]

                    The need to optimize rises from a bad design.My articles[^]

                    W Offline
                    W Offline
                    wjbjnr
                    wrote on last edited by
                    #9

                    thanks for you link.. But i had sql 2008 , so it had different settings. http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/[^] that link was for 2008 , seems like the browser setting had problems ::) it was turned off. . but in the end it all worked out! You were a great help!, i learned many things!! Thanks for your support!

                    W 1 Reply Last reply
                    0
                    • W wjbjnr

                      thanks for you link.. But i had sql 2008 , so it had different settings. http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/[^] that link was for 2008 , seems like the browser setting had problems ::) it was turned off. . but in the end it all worked out! You were a great help!, i learned many things!! Thanks for your support!

                      W Offline
                      W Offline
                      Wendelius
                      wrote on last edited by
                      #10

                      You're welcome :) Glad it got solved.

                      The need to optimize rises from a bad design.My articles[^]

                      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