SQL SERVER – Fix : Error : 1326 Cannot connect to Database Server Error: 40 – Could not open a connection to SQL Server

If you are receiving the following error related to connection to SQL Server, this blog is for you.

TITLE: Connect to Server
——————————
Cannot connect to Database Server.
——————————
ADDITIONAL INFORMATION:
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 1326)

I suggest that you read previous article first as that describes how to fix the problem and has worked in many cases.

SQL SERVER – Fix : Error : 40 – could not open a connection to SQL server

Now if SQL Server can be connected perfectly from local system, but cannot be connected from a remote system, in that case firewall on the server where SQL Server is installed can be issued.

SQL SERVER - Fix : Error : 1326 Cannot connect to Database Server Error: 40 - Could not open a connection to SQL Server firewall4

Follow instructions of this article to fix the issue.

Go to control panel >> Firewall Settings >> Add SQL Server’s Port to Exception List.

SQL SERVER - Fix : Error : 1326 Cannot connect to Database Server Error: 40 - Could not open a connection to SQL Server firewall

SQL SERVER - Fix : Error : 1326 Cannot connect to Database Server Error: 40 - Could not open a connection to SQL Server firewall2

SQL SERVER - Fix : Error : 1326 Cannot connect to Database Server Error: 40 - Could not open a connection to SQL Server firewall3

Now try to connect to SQL Server again. It will allow you to connect to the server successfully. Please leave a comment with your experience.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Database, SQL Error Messages, SQL Server Security
Previous Post
SQLAuthority News – Security Update for SQL Server 2000 Service Pack 4 and MSDE 2000
Next Post
SQLAuthority News – SQL Server 2008 Downloads Availables

Related Posts

141 Comments. Leave new

  • I had the same problem on my remote worked perfectly but not locally, then when I wanted it to work you move around and move it badly an option in “Client Network Utility” when he was in that tab or window I select “Force Protocol Ciphers” just remove it and that you will return to normal at least so I resolved my problem …

    I hope they serve
    thanks
    Greetings from Mexico.

    Reply
  • I have installed sql server management studio 2008 from http://www.microsoft.com/en-us/download/details.aspx?id=7593

    I started service sqlserver2008 from services.msc
    But while connect (through connect to pop up) to database engine I cant see any Local servers its empty.

    Is sql server not installed whats issue ?? Thanks in advance

    Reply
  • Hi,
    Could you please tell me what is the meaning of ‘Property login was not set’ in sql server 2008 R2? because of this I am unable to connect with Database Engine, Analyst services & reporting services ?

    Thanks
    Neela

    Reply
  • I installed SQL 2012 Express onto a VMWare VM running Windows Server 2008R2. I had no problem connecting locally on the VM. However, I was unable to connect to it from a remote machine until I overrode the server’s default Windows Advanced Firewall Public Profile for Incoming Connections of Blocked to Allow. Adding incoming connections for port 1433 did not seem to work. FWIW.

    Reply
    • I am actually having the same problem now, SQL 2012 express running in WServer 2008R2, but trying to connect from an application running in a windows 7 pc. Did you solve the connection issue?

      Reply
  • Hi i am getting the problem sometimes it open the sqlserver without any problem but some times it gives the error:-
    cannot connect to smarty-pc
    A network related or instance specific error occured while establishing the connection to sql server server is not found or accessible.verify that istance name is correct and sql server is configure to allow remote connection.(provider:named pipe provider,Error 40-could not open a connection to sqlserver)(Microdoft sqlserver error -2)

    I am already tried:-sql server configuration manager
    where protocol for sqlexpress shared memory,named pipeline,TCP/IP,VIA all are enabled.
    2)Control panel >Firewall>Exception>Remote assistence(checked)>Add port>Then sql comes in exception list with checkbox checked.

    It still give the same problem Tell me how to recover from it????

    Reply
  • hello sir! thanks from your nice and outstanding cooperation.
    i read these all information like how to install SQL server but i have some problems the problems i try to connect SQL with database but it did work

    Reply
  • PRIOR to put your pc name or server name /sqlexpress when you call your local SqlServer -because sqlserver express 2008 by default names your sql server like that

    Reply
  • how can firewall setting on windows 7 ?

    Reply
  • how can filewall setting on windows 7 ?

    Reply
  • I have read many posts about this error and still have issue. Here is my configuration.

    Running SQL Server Express Edition 2008
    TCP/IP is enabled
    Using Windows Authentication
    Only 1 instance – CHDC04\SQLEXPRESS
    User name for this PC is listed under “users” on server

    On Client running Windows 7 trying to open a MS Access adp file that has the following connection string:

    This is my VB code that runs on startup of the application:

    BaseCS = “PROVIDER=SQLOLEDB.1;INTEGRATED SECURITY=SSPI;PERSIST SECURITY INFO=FALSE;INITIAL CATALOG=LeadTrack;DATA SOURCE=CHDC04\SQLEXPRESS;Use Procedure for Prepare=1;Auto Translate=True”

    CurrentProject.OpenConnection BaseCS

    Try to run application and get
    “Sql Server does not exist or access is denied”

    I have tried adding port 1433 to the connection string too, but that has not helped. Please point me in the right direction.

    Reply
  • Can you help me? i have problem in my Sql server 2008 that i cant to connect my server name,, because its deleted..
    i wanna its back. and i wanna use it again.
    can you explain a solution?

    Reply
  • Hello. I’m on a Windows 7 – 64 bit OS. I have Norton 360 installed (that takes over Windows Firewall settings). I’ve re-installed SQL Server Management program 5 times (and rebooted after every removal and reinstallation).. but I cannot connect. I don’t even see a SQL Service created. Any ideas?

    Reply
  • no, its not solve my problem, after doing this i am still on this error, sql not connect to server. Now what i do?

    Reply
  • We have a MS SQL DB server for Cricket DB .
    The requirement is to Enable a Oracle Subscription for a sql server Publisher on our cricket DB, so that we can send live updates in real time.

    I am facing an issue while configuring the subscription.
    This is what I have tried:
    1. Configured a sql server publication with articles
    2. Tried to configure an Oracle subscriber to publication configured in step 1 but seems like the Data source Name is not being recognized by the sql server.
    It does say the subscription is configured but it gives error while initializing the snapshot.
    Any idea on what could be going wrong here?

    Also, one issue here is, I think it looks for TNSNAMES.ORA file for the data source name that I provide. I have sql developer as the oracle client and I don’t connect using the TNS name.
    In this case where do I need to place the TNSNAMES.ora file?

    Any thoughts on this would be appreciated.
    Also if you are aware of any alternate way to approach this it would be helpful. Please advise.

    Reply
  • Greate link to know which port is sql connected to. Thanks Imran Mohammed

    Reply
  • Hi there.
    I have this error, then I couldn’t connect to only one of my server instance(MSSQLSERVER).
    —————————–
    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) (Microsoft SQL Server, Error: 2)

    —————————–

    so I couldn’t connect to only one of my server instance (MSSQLSERVER). So I checked the server configuration manager and I see
    SQL server (MSSQLSERVER)
    SQL Server Agent (MSSQLSERVER)
    SQL Full-text Filter(MSSQLSERVER) are not running, even when I start them manually.

    Then I changed the protocols for MSSQLSERVERVIA (status to disabled)

    Then error is resolved.
    I tried in different ways fixing the error and making the error.
    Thanks.

    Reply
  • Hi,
    I have 2 copies of SQL Server installed on my local PC, SQL 2008 and SQL 2012.
    When I start ‘SQL Server Management Studio’ for SQL 2012 and I enter (local) as the ‘Server name’ the SQL 2008 engine is loaded/used.
    How can I get the SQL 2012 engine to loaded/to be used when I enter (local)?
    Thanks in advance,
    David

    Reply
  • even microsoft can not resolve this….this differs from pc to pc…once pc connects and other not…..both intalled together….. crazy SQL server

    Reply
  • hi, i was having trouble with connecting to SQL 2000 which installed on windows 2k8 R2.
    while i’m on client computer trying to connect to server using sql server management studio, it’s could not connect and show error 1326. why ?

    Reply
  • vennela kosaraju
    July 10, 2014 6:08 pm

    thanks for the post.. it helped me out

    Reply

Leave a Reply