none
Please help SQL connection string!

    Pergunta

  • hi there, i have a connection string to an SQL server 2008 r2 database. it works fine when accessing trough local host but when i try and access it through ip address it does not work ...eg....

    {Server=localhost;Database=master;Trusted_Connection=Yes}     this works!

    {Server=88.208.232.154;Database=master;Trusted_Connection=Yes}   this does not!

    {Server=192.168.XXX.XXX;Database=master;Trusted_Connection=Yes}     this does not even work, even though i have replaced localhost with my local ip address!

    any help would be greatly apprecciated

    thanks


    james

    sexta-feira, 2 de março de 2012 11:57

Respostas

  • Hello,

    As you are posting in the SQL Server Express forum, i suppose that you have installed a SQL Server Express instance. I was thinking that the default name for a SQL Server Express is SQLEXPRESS ( with a Web,Standard,Entreprise edition the default proposed name is empty , giving a no-named instance) . Why i don't see any real name in the Server field of the connection ?

    I prefered always to provide .\NameOfInstance or NameOfMachine\NameOfInstance as value for the Server property

    See http://blogs.msdn.com/b/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx 

    Moreover you will have problems the day where you will install another SQl Server instance ( you will need my way to differentiate your both instances )

    If you have only one installed installed , your 1st connection string should always work ( not tested on SQL Server 2012 ex-Denali ). For the two last connection string , add the name of your instance to the end of the value for Server ( separated by a \ and not by / as too often i have seen ).

    if you have installed SSMSE ( SQL Server Management Studio Express ) , try to use it to connect. To discover all the available SQL Server instances, in the Server combobox, select the last value ( Search... , maybe a bad translation from what i can see in my french SSMS ). You should arrive to a new form with 2 visible tabpages ( the 1st one is for the local instances, the 2nd one is for the remote and local instances ).Select the 2nd tabpage , you should see the full name of your instance

    I hope that you will excuse for my french SSMS ( Serveurs réseaux = network servers )

    You can see that 3 instances :

    the 1st one is the local instance ( ComputerName AD-PC short instance name SQLEXPRESS1 ) the 2 last ones are on remote on the ComputerName LAMBIB-1D6EECAC ( DEV2008 Developer 2008 SP3 and SQLEXPRESS1 SQL Server Express with Advanced Services 2008 SP3 )

    Have you tried to use the SQL Server Configuration Manager to provide the IP address  ( to use an IP address, you have to enable the TCP/IP protocol ) ?

    Don't hesitate to post again for more help or explanations

    Have a nice day


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    sexta-feira, 2 de março de 2012 14:45

Todas as Respostas

  • Can you connect if you give the servername?

    If you ping the ip address does it resolve to the hostname? If you ping the hostname does it resolve to the same ip's that you were trying with?


    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

    sexta-feira, 2 de março de 2012 12:05
  • Hello,

    As you are posting in the SQL Server Express forum, i suppose that you have installed a SQL Server Express instance. I was thinking that the default name for a SQL Server Express is SQLEXPRESS ( with a Web,Standard,Entreprise edition the default proposed name is empty , giving a no-named instance) . Why i don't see any real name in the Server field of the connection ?

    I prefered always to provide .\NameOfInstance or NameOfMachine\NameOfInstance as value for the Server property

    See http://blogs.msdn.com/b/sql_protocols/archive/2008/09/19/understanding-data-source-local-in-sql-server-connection-strings.aspx 

    Moreover you will have problems the day where you will install another SQl Server instance ( you will need my way to differentiate your both instances )

    If you have only one installed installed , your 1st connection string should always work ( not tested on SQL Server 2012 ex-Denali ). For the two last connection string , add the name of your instance to the end of the value for Server ( separated by a \ and not by / as too often i have seen ).

    if you have installed SSMSE ( SQL Server Management Studio Express ) , try to use it to connect. To discover all the available SQL Server instances, in the Server combobox, select the last value ( Search... , maybe a bad translation from what i can see in my french SSMS ). You should arrive to a new form with 2 visible tabpages ( the 1st one is for the local instances, the 2nd one is for the remote and local instances ).Select the 2nd tabpage , you should see the full name of your instance

    I hope that you will excuse for my french SSMS ( Serveurs réseaux = network servers )

    You can see that 3 instances :

    the 1st one is the local instance ( ComputerName AD-PC short instance name SQLEXPRESS1 ) the 2 last ones are on remote on the ComputerName LAMBIB-1D6EECAC ( DEV2008 Developer 2008 SP3 and SQLEXPRESS1 SQL Server Express with Advanced Services 2008 SP3 )

    Have you tried to use the SQL Server Configuration Manager to provide the IP address  ( to use an IP address, you have to enable the TCP/IP protocol ) ?

    Don't hesitate to post again for more help or explanations

    Have a nice day


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    sexta-feira, 2 de março de 2012 14:45