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. how do I find the IP of the 2005 sql server instance?

how do I find the IP of the 2005 sql server instance?

Scheduled Pinned Locked Moved Database
databasequestionsql-serversysadmintutorial
21 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.
  • T Tunisien86

    Hi JHizzle, I create a new sql command like this:

    string adr="SELECT @@SERVERNAME AS 'Server Name';";
    string sConnection = "Data Source= adr,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

    When running the application, this error appears:

    Sql server adress not found:adr,1433

    added to this notification:

    Warning 1 The variable 'adr' is assigned but its value is never used

    What is the problem?? Thanks

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

    Ok, wait, back up here. Do you or do you not have remote access to the server via SQL Server management studio or query analyzer? The previous answer should have been run using a query window within either of these. What does you actual connection string contain: is it the SQL server name or its IP address? If it's the name and it works from your deelopment box, use that in a command prompt with the ping command to grab the IP address.

    T 1 Reply Last reply
    0
    • T Tunisien86

      Hi JHizzle, I create a new sql command like this:

      string adr="SELECT @@SERVERNAME AS 'Server Name';";
      string sConnection = "Data Source= adr,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

      When running the application, this error appears:

      Sql server adress not found:adr,1433

      added to this notification:

      Warning 1 The variable 'adr' is assigned but its value is never used

      What is the problem?? Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #9

      The problem is that you're asking Sql server where Sql server is located. The name "ADMIN-PC" points to an IP-adress. Your data source would be "ADMIN-PC\SQL2005", or something similar. It may very well be that you require the IP-adress to connect from the PDA to the server. That requires you to know at least the connection-details of your server, and it will require a network-connection.

      I are Troll :suss:

      T 1 Reply Last reply
      0
      • J JHizzle

        Ok, wait, back up here. Do you or do you not have remote access to the server via SQL Server management studio or query analyzer? The previous answer should have been run using a query window within either of these. What does you actual connection string contain: is it the SQL server name or its IP address? If it's the name and it works from your deelopment box, use that in a command prompt with the ping command to grab the IP address.

        T Offline
        T Offline
        Tunisien86
        wrote on last edited by
        #10

        Hi, I have remote access to the server(I go to :right click on the server name in sql server managment->connections here I find that remote connections to the server allowed).I don't understand what u mean by query analyzer?? My string connexion should contain the SQL server 'IP @ like this:

        string adr="SELECT @@SERVERNAME AS 'Server Name';";
        string sConnection = "Data Source= adr,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

        Thanks

        J 1 Reply Last reply
        0
        • L Lost User

          The problem is that you're asking Sql server where Sql server is located. The name "ADMIN-PC" points to an IP-adress. Your data source would be "ADMIN-PC\SQL2005", or something similar. It may very well be that you require the IP-adress to connect from the PDA to the server. That requires you to know at least the connection-details of your server, and it will require a network-connection.

          I are Troll :suss:

          T Offline
          T Offline
          Tunisien86
          wrote on last edited by
          #11

          Hi Eddy, If the name of my server in sql server is:ADMIN-PC (SQL Server 9.0.1399 - sa),what sould be the datasource field???is it like that:

          string sConnection = "Data Source= ADMIN-PC\\SQL Server 9.0.1399 - sa,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

          Thanks for u clarification

          L 1 Reply Last reply
          0
          • T Tunisien86

            Hi, I have remote access to the server(I go to :right click on the server name in sql server managment->connections here I find that remote connections to the server allowed).I don't understand what u mean by query analyzer?? My string connexion should contain the SQL server 'IP @ like this:

            string adr="SELECT @@SERVERNAME AS 'Server Name';";
            string sConnection = "Data Source= adr,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

            Thanks

            J Offline
            J Offline
            JHizzle
            wrote on last edited by
            #12

            Ok, I think I know what you're meaning now. Have you tried just assigning Data Source as ADMIN-PC? The brackets after are just a versioning thing within SQL. If you want the IP address, command prompt -> ping admin-pc

            T 1 Reply Last reply
            0
            • T Tunisien86

              Hi Eddy, If the name of my server in sql server is:ADMIN-PC (SQL Server 9.0.1399 - sa),what sould be the datasource field???is it like that:

              string sConnection = "Data Source= ADMIN-PC\\SQL Server 9.0.1399 - sa,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

              Thanks for u clarification

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #13

              Something along these lines;

              string sConnection = "Data Source= ADMIN-PC\\SQL2005;Initial Catalog=GMAO;User ID=sa;Password=sa;";

              or, for the default instance;

              string sConnection = "Data Source= ADMIN-PC;Initial Catalog=GMAO;User ID=sa;Password=sa;";

              ..and no, it's not going to be that simple. Take a deep breath and make some coffee :) --edit; Location and instance-name of Sql Server are determined when you install it[^]. Your PDA-application needs to "know" where this server is, and it needs to be in the same network as that computer. At this moment I'm still wondering whether you have network-connectivity between those two.

              I are Troll :suss:

              modified on Friday, May 7, 2010 11:34 AM

              T 1 Reply Last reply
              0
              • J JHizzle

                Ok, I think I know what you're meaning now. Have you tried just assigning Data Source as ADMIN-PC? The brackets after are just a versioning thing within SQL. If you want the IP address, command prompt -> ping admin-pc

                T Offline
                T Offline
                Tunisien86
                wrote on last edited by
                #14

                Hi, ping admin-pc gives this result:

                C:\Users\Admin>ping admin-pc

                Pinging Admin-PC [fe80::cc28:8ea3:82ea:4c4f%13] with 32 bytes of data:
                Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms
                Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms
                Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms
                Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms

                Ping statistics for fe80::cc28:8ea3:82ea:4c4f%13:
                Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
                Approximate round trip times in milli-seconds:
                Minimum = 0ms, Maximum = 0ms, Average = 0ms

                where is the @IP?? I am really disturbed :doh: thanks

                J 1 Reply Last reply
                0
                • T Tunisien86

                  Hi, ping admin-pc gives this result:

                  C:\Users\Admin>ping admin-pc

                  Pinging Admin-PC [fe80::cc28:8ea3:82ea:4c4f%13] with 32 bytes of data:
                  Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms
                  Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms
                  Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms
                  Reply from fe80::cc28:8ea3:82ea:4c4f%13: time<1ms

                  Ping statistics for fe80::cc28:8ea3:82ea:4c4f%13:
                  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
                  Approximate round trip times in milli-seconds:
                  Minimum = 0ms, Maximum = 0ms, Average = 0ms

                  where is the @IP?? I am really disturbed :doh: thanks

                  J Offline
                  J Offline
                  JHizzle
                  wrote on last edited by
                  #15

                  It's right there. That thar be a IPv6 address. I don't know what your network setup is but I suspect you're not going to be able to mess with it as I am assuming company network, in any case, go talk to your infrastructure team to get the IPv4 version for that SQL server instance.

                  1 Reply Last reply
                  0
                  • L Lost User

                    Something along these lines;

                    string sConnection = "Data Source= ADMIN-PC\\SQL2005;Initial Catalog=GMAO;User ID=sa;Password=sa;";

                    or, for the default instance;

                    string sConnection = "Data Source= ADMIN-PC;Initial Catalog=GMAO;User ID=sa;Password=sa;";

                    ..and no, it's not going to be that simple. Take a deep breath and make some coffee :) --edit; Location and instance-name of Sql Server are determined when you install it[^]. Your PDA-application needs to "know" where this server is, and it needs to be in the same network as that computer. At this moment I'm still wondering whether you have network-connectivity between those two.

                    I are Troll :suss:

                    modified on Friday, May 7, 2010 11:34 AM

                    T Offline
                    T Offline
                    Tunisien86
                    wrote on last edited by
                    #16

                    Hi Eddy, I have not a real PDA to check.I wanna use only the emulator on my application. Also I changed my code someway:

                    string adr="SELECT @@SERVERNAME AS 'Server Name';";
                    string sConnection = "Data Source=" + adr + ",1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

                    but not knowing my SQL SERVER If I installed saye my sql server and don't get the info about the instance,noway to know it after???? I am really boulversing Thanks :doh:

                    L 1 Reply Last reply
                    0
                    • T Tunisien86

                      Hi Eddy, I have not a real PDA to check.I wanna use only the emulator on my application. Also I changed my code someway:

                      string adr="SELECT @@SERVERNAME AS 'Server Name';";
                      string sConnection = "Data Source=" + adr + ",1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

                      but not knowing my SQL SERVER If I installed saye my sql server and don't get the info about the instance,noway to know it after???? I am really boulversing Thanks :doh:

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #17

                      Tunisien86 wrote:

                      If I installed saye my sql server and don't get the info about the instance,noway to know it after????

                      Well, you can, using the very same SQL statement that you're posting.

                      • Open Sql Management Studio Express, and connect to the server
                      • Start a new query
                      • Execute the statement SELECT @@SERVERNAME

                      That would result in a string in the format "Computername/Instancename". I'd recommend creating a small application to do a simple select against that server; It's easier to build and limits the scope of the problem to "connect to Sql Server from a PDA".

                      I are Troll :suss:

                      T 1 Reply Last reply
                      0
                      • L Lost User

                        Tunisien86 wrote:

                        If I installed saye my sql server and don't get the info about the instance,noway to know it after????

                        Well, you can, using the very same SQL statement that you're posting.

                        • Open Sql Management Studio Express, and connect to the server
                        • Start a new query
                        • Execute the statement SELECT @@SERVERNAME

                        That would result in a string in the format "Computername/Instancename". I'd recommend creating a small application to do a simple select against that server; It's easier to build and limits the scope of the problem to "connect to Sql Server from a PDA".

                        I are Troll :suss:

                        T Offline
                        T Offline
                        Tunisien86
                        wrote on last edited by
                        #18

                        Hi Eddy, :laugh: I found the solution ther in this post: http://www.sqlservercentral.com/Forums/Topic918470-323-1.aspx?Update=1[^] My string connection is like that now:

                        string sConnection = @"Data Source=Admin-PC\MSSQLSERVER,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

                        (But Eddy still some problems in my TCP/IP connection :(( ) Thanks

                        L 1 Reply Last reply
                        0
                        • T Tunisien86

                          Hi Eddy, :laugh: I found the solution ther in this post: http://www.sqlservercentral.com/Forums/Topic918470-323-1.aspx?Update=1[^] My string connection is like that now:

                          string sConnection = @"Data Source=Admin-PC\MSSQLSERVER,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";

                          (But Eddy still some problems in my TCP/IP connection :(( ) Thanks

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #19

                          Tunisien86 wrote:

                          I found the solution ther in this post: My string connection is like that now:

                          That's looking better :)

                          Tunisien86 wrote:

                          But Eddy still some problems in my TCP/IP connection

                          There's some bumps on the road, but we can tackle them one atta time. I'd suggest starting with a "New Project", and to create a small prototype application that connects to the server and displays the results of the query, or the Exception if one is generated. Your connectionstring should be enough to allow you to create a SqlConnection.

                          I are Troll :suss:

                          T 1 Reply Last reply
                          0
                          • L Lost User

                            Tunisien86 wrote:

                            I found the solution ther in this post: My string connection is like that now:

                            That's looking better :)

                            Tunisien86 wrote:

                            But Eddy still some problems in my TCP/IP connection

                            There's some bumps on the road, but we can tackle them one atta time. I'd suggest starting with a "New Project", and to create a small prototype application that connects to the server and displays the results of the query, or the Exception if one is generated. Your connectionstring should be enough to allow you to create a SqlConnection.

                            I are Troll :suss:

                            T Offline
                            T Offline
                            Tunisien86
                            wrote on last edited by
                            #20

                            Hi Eddy, As u told me,I open a new thread:SQL server name not found:Admin-PC\MSSQLSERVER,1433 but still not working yet :(( Thanks Eddy (after this long collaboration between as i suggest if u like we meet in msn or skype as freinds ok :laugh: my skype is :elgafsiensi and my msn is:marwenG@hotmail.fr)

                            L 1 Reply Last reply
                            0
                            • T Tunisien86

                              Hi Eddy, As u told me,I open a new thread:SQL server name not found:Admin-PC\MSSQLSERVER,1433 but still not working yet :(( Thanks Eddy (after this long collaboration between as i suggest if u like we meet in msn or skype as freinds ok :laugh: my skype is :elgafsiensi and my msn is:marwenG@hotmail.fr)

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #21

                              Tunisien86 wrote:

                              As u told me,I open a new thread:SQL server name not found:Admin-PC\MSSQLSERVER,1433

                              Not a new thread, but a new project :) A small application to "prove" that it works and to test whether all settings are correct.

                              Tunisien86 wrote:

                              but still not working yet

                              You know the drill; we'd need code and an exception-message to diagnose something.

                              Tunisien86 wrote:

                              Thanks Eddy(after this long collaboration between as i suggest if u like we meet in msn or skype as freinds ok

                              You're welcome. I'll add you to the list, I'm online once or twice every month :)

                              I are Troll :suss:

                              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