locked
Damn this (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) RRS feed

  • Question

  •  

    Well my problem is this error message Message="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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

     

    but :

     

    -can't connect to SqlServer Express 2005 on my network server from my application while ITS RUNNING. What I mean is that when I use Server Explorer Window on VS2008 every thing is fine (I can even insert and modify data from server explorer), in fact, when I use Datatables and I choose to preview data through TableAdapters (Design Time) I get data, and also can run the queries from there directly to the data base, but when I'm debbugin the application I get this error.

     

    -when I run Sql Server Management Studio, its also fine, even though I can't see the Sql instance on the server (or any of my partners machine) when I try to browse them. But if I type the server path (servername\instancename) everything is OK.

     

    -I know the problem is not the connection string 'cause mya partners nd I use the same one to connect to the server, and no one has this problem.

     

    -also tried to shut down my firewall and the server's also, and nothing.

     

    -ok here are the specs for both, server and client pc:

     

      SERVER:

    *Running Windows Server 2008 64 bits

    *Sql Server Express 2005 SP2 x86 (WOW)

      Client:

    *Running Windows Vista Ultimate SP1 64 bits

    *Sql Server Express 2005 SP2 x86 (WOW)

    *Sql server 2008 Enterprise 64 bits

    *VS 2008 Team Suite.

      Everyone Else:

    *Windows Vista ultimate 32 bits

    *Sql Server Express 2005 SP2

    So can you help me?? please, I'm working localy only, so is a pain doing this

    Monday, October 27, 2008 7:44 PM

Answers

  • One major difference between express and other SKUs of SQL Server is that the Express SKU installs as a named instance (<machinename>\sqlexpress) by default whereas other SKUs install as a "default" instance (machinename) by default.  If you just click through without reading and use the same connection string across different machines, then the connection string target server is probably ".\sqlexpress" or "(local)\sqlexpress".  In either case, this would not work for a default instance.  To share the connection strings, the easiest thing to do might be to install your SQL Server as a named instance named "SQLEXPRESS" or to install the express instances as a "default" instance.

    I suspect that, at this point, this is the most likely problem.

    Hope that helps.

    John

    This post is provided 'as is' and confers no express or implied warranties or rights.
    Tuesday, January 6, 2009 1:13 AM

All replies

  • Well...are you connecting to the correct SQL Server? I know you mentioned that you checked your connection string, but is it pointing to your local SQL or the server SQL? Which one are you trying to access?

     

    Is your computer the 'only' one that can't connect in debug mode?

     

    Honestly...I would not look at the connection string. You have probably looked at it so many times that you would overlook even the most obvious error. I would completely delete it, and copy/paste it from another project.

     

    A.D.T.

     

    Monday, October 27, 2008 8:19 PM
  • We are all working in the same project through Visual SourceSafe, the project is shared with 6 more computers, so there's no point in copying the connection string 'cause its the same,

     

    and yes, actually my code runs in the other computers (all of them, no exceptions);

    I configured my firewall exactly the same way as the other 5, the only difference between them and my computer is:

    Windows Vista 64bits (mine)  Versus Windows Vista 32bits (them)

    SqlServer 2008(mine)             Versus SqlServer Express (Them/Server )

     

     

    Monday, October 27, 2008 8:35 PM
  • Why is it relevant to mention the SQL version on your workstation? Does your code query the local db or the server db?

     

    If it's querying your 2008, the instance may be different. That seems to be the 'only' difference that I've spotted so far.

     

    A.D.T.

     

    Monday, October 27, 2008 8:53 PM
  •  

    Actually I've only mention them to point out the differences between machines, besides that they are all configured the same way to access the DB, so we are NOT connecting through local instances, we are connecting directly to de Servers Sql,

     

    Now, the problem is happening through Visual Studio when I debug the application, I'm trying data access with ADO entity framework, and Using DataSets, Its all the same,

    using Linq Queries I receive a different error, but looking at the exception log, the internal message is the same error: 26

     

    can it be a hardware problem??

    Monday, October 27, 2008 9:07 PM
  • Friend, I am clueless...just out of curiosity, when's the last time you've rebooted your workstation?

     

    A.D.T.

     

    Monday, October 27, 2008 9:12 PM
  • damn, hahaha don't worry thanks any way

     

    Monday, October 27, 2008 9:18 PM
  • damn, hahaha don't worry thanks any way

     

    I've just bought brand new, it has like 2 months old

    Monday, October 27, 2008 9:19 PM
  • One major difference between express and other SKUs of SQL Server is that the Express SKU installs as a named instance (<machinename>\sqlexpress) by default whereas other SKUs install as a "default" instance (machinename) by default.  If you just click through without reading and use the same connection string across different machines, then the connection string target server is probably ".\sqlexpress" or "(local)\sqlexpress".  In either case, this would not work for a default instance.  To share the connection strings, the easiest thing to do might be to install your SQL Server as a named instance named "SQLEXPRESS" or to install the express instances as a "default" instance.

    I suspect that, at this point, this is the most likely problem.

    Hope that helps.

    John

    This post is provided 'as is' and confers no express or implied warranties or rights.
    Tuesday, January 6, 2009 1:13 AM
  • Hello Freddyccix,

    Please, could you provide your exact and complete connection string ?
    I never use a connection string with ".\SQLEXPRESS" or "(local)\SQLEXPRESS".
    I always use "ComputerName\SQLEXPRESS" where ComputerName is the name of the machine where the Sql Server Express is residing ( if i deploy the application on another machine, the name of Sql Server machine is resolved already ) ( it is just a little add-in to the excellent post John Gordon ).
    You may also have a problem of port for the Sql Server Service ( if the port of your Sql Server Service is not 1433, you have to include it in the connection string )
    Check also the state of your Sql Browser service ( if it is stopped , you cannot see your instance, idem if you have a firewall which may block this service )

    Please, could you have a look on this excellents post of Mike Wachal ?
    http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/824eb041-969f-4837-b8e9-e236d5d0a3c0
    and also this blog for all prolem of connection ( especially for the error 26 )
    http://blogs.msdn.com/sql_protocols/default.aspx

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

    Have a nice day

    PS : if it is a problem of port, you may find the port number in the ERRORLOG ( the "classical" path is given in the post of Mike )
    or thru the SAC program ( Surface configuration program )
    Please remember to click 'Mark as Answer' on the post that helped you. Unmark if it provides no help
    Wednesday, January 7, 2009 8:39 AM
  • Hi mate,

    I have had a same problem. and all I did was to right click on connection under servers pane --> modify connection --> change data source to . (just dot) and user instance = false

    that solved the error.

    Hope this helps guys.
    Monday, July 13, 2009 1:44 PM
  • YOU ARE A GENIOUS!

    Anyways thanks, this worked great for me.
    Tuesday, November 24, 2009 8:29 AM
  • mmm how do you get to the 'servers pane'? Cannot find it!

    Thanks
    E.
    • Proposed as answer by bjoernklose Tuesday, February 16, 2010 2:39 PM
    Tuesday, November 24, 2009 5:16 PM
  • If you are using Visual Studio, look at the top let corner under Server Explorer
    You will see "Data Connections" where you have your database. If your database is not showing there, upload it if is not showing in the right top corner under Solution Explorer. If it is, righ click on it, then click on open (you can also just double click on it) This action will cause the database to show in the left top corner under "Server Explorer"

     Once there, right click on your database, then click on "Modify Connection". Click on "Advanced"; here you will look for "User Instance" (set to False) and "Data Source"; here click on the down arrow and change to (.) just the dot.

    I didn't meant to explain at an 8th grader level but sometimes it helps.
    Friday, November 27, 2009 5:20 AM
  • I had this error too '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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)'

    check the firewall rule (default tcp1433 , client to server)

    be sure username or password is correct

    type servername correctly , and check the dns can solve this name or try with ip

    go to sql server configuration manager --> network configuration --> tcp ip properties , tcp field must be full

    and finally sql server browser must be running.

     

    • Proposed as answer by knujliam Thursday, February 9, 2012 7:05 PM
    • Unproposed as answer by knujliam Thursday, February 9, 2012 7:06 PM
    Wednesday, October 13, 2010 1:00 PM
  • When you get the following error:

    Exception while connecting to Database ---> System.Data.SqlClient.SqlException: 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Check the ISSPOSDataSet.Designer.cs class file (open in notepad) in the TableAdapter project file for the following string:

    ].Connection = new global::System.Data.SqlClient.SqlConnection(global::

    Each table adapter has a InitCommandCollection method that defines the individual CommandCollection connections and these should point to the module level connection:

    ].Connection = this.Connection;

    This happens at some point during development when new connections are created at design time.  To debug the issue, step into the code and drill into the individual command collection connections.  

    What you may see is something different from this.Connection.  When I see this problem, I edit the designer cs in notepad to avoid regenerating this file.  Since we ported to VS2010 these things have been prone to wierd behaviour.

    Thursday, February 9, 2012 7:11 PM
  • After 4 hours of searching for an solution to my problem, finally your answer solved it, thank you.

    Baris

    Tuesday, March 6, 2012 11:05 AM