Connection from Visual Studio to SQL Server 2005 - sql-server

In Visual Studio 2010 I am trying to set up a connection with a SQL Server database with the add connection wizard but the connection fails!
This is the error I get:
a network-related or instance-specific error occured 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)
Extra info;
I can ping the server!
Remote connections are allowed on the SQL Server!
SQL service is running!
What is here the problem?

To work around this problem, use one of the following methods depending on the symptom that you are experiencing:
A SQL Server login
Use a valid Windows login to connect to SQL Server. If you must continue to use a SQL Server login, you can change the security authentication mode in SQL Server to SQL Server and Windows.
A Windows account with insufficient permissions
To work around this problem, you must add the Windows account to SQL Server, and then grant the appropriate permissions to each database that the user requires access to.
Source: http://support.microsoft.com/kb/889615/en-us

Related

UWP cannot connect to local SQL Server

I'm creating a simple UWP application working together with my local DB server I set up with SQL Server Management Studio.
I can successfully set up a connection in the server explorer and run queries in the DB:
However when I run the application I get an error when the connection is being established:
System.Data.SqlClient.SqlException HResult=0x80131904 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: 25 - Connection string is not valid) Source=Core .Net SqlClient Data Provider
I'm not sure if it's a problem with the connection string or what else it could be. I checked the firewall settings and everything seems to be fine. The SQL server settings also allow for remote connection.
Which SQL Server version is running?
Have you tried with the following connection string format?
Data Source=.\\MSSQLServer;Initial Catalog=PapaDario;Trusted_Connection=yes;
Before you connect to your database, some aspect of the SQL Server configuration needs to be changed. First, ensure that you've enabled TCP/IP for SQL Server. You can do that in the Computer Management console. Then make sure that your SQL Server Browser service is running.

SSIS OLEDB Connection Manager - Unable to connect to a database (No database names appear)

I am trying to create a connection manager in Microsoft SQL Server Data Tools for Visual Studio 2017 (SSDT) for an integration services project.
In the Connection Manager:
The Provider is set to: Native OLE DB\SQL Server Naive Client 11.0
The Server name is set to: the name of the local machine
Log on to the server is set to: Windows Authentication
Connect to a database is set to: Select or enter a database name. However no database names appear in the drop down box - the drop down box is blank. I am expecting the name of the database i am working on, including the master database etc to be present.
When I Test Connection, I get an error message which says:
'Test connection failed because of an error in initializing provider. Login timeout expired
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
Named Pipes Provider: Could not open a connection to SQL Server [2]..'
I am using SQL Server 2017 and Microsoft SQL Server Management Studio 18.
Allow remote connections has been ticked in SSMS.
The only thing i can see is the SQL Server Agent and SQL Server Browser has stopped / is not running and the TCP/IP Protocols for SQLEXPRESS is set to disabled - I am unable to enable it without a further Access is denied (0x80070005) error.
I have tried to follow all of the guides but cannot progress. Could somebody please offer some further guidance?
I have resolved the issue. It was an extremely silly oversight! On installation, the server name in the Visual Studio 17 Connection Manager was listed as: Local MachineName only. In SQL Server, the Server Name was listed as: LocalMachineName\SQLEXPRESS. The Server Name in VS17 has to be exactly the same as SQL Server. As i said, this is a very silly oversight on my part but have documented for future reference.
SQL Server Configuration Manager ==> SQL Server Services(Left sidebar) ==> Right Click and Start all Stopped services

Remote Sql Server connection with MSSMS

I am trying to connect to a remote sql server. I write the IP a.b.c.d into a server name, then I put username test and password test. This account has all Server Roles selected (I also tried with another account which only had public) and the databases I want to allow the user to manage (in User Mapping section) also have public and db owner. I have completed all the steps in here and I got it working on my local network with another computer in LAN having the server set up.
The error I get looks like this:
===================================
Cannot connect to a.b.c.d.
===================================
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) (.Net SqlClient Data Provider)
===================================
The user name or password is incorrect
But I can connect with the same credentials in the server itself, so I assume either: something is configured in a wrong way or I have to write the login name in some different fashion.
My both MSSQL programs (in two different computers) were installed with SQL Server 2012 Standard and SQL Server 2014 Express and the one I am trying to connect to is SQL Server 2008 R2 Express. However, at work, I have no problem connecting with version of MSSMS being different from the Server, so I doubt it is the case.
Any ideas what I am missing/doing wrong?

Unable to connect from local to SQL Server in Virtual Machine on Windows Azure

I'm trying to connect from a local SQL Server Management Studio to a SQL Server hosted in a VM on Azure.
I followed all the instructions from
http://www.windowsazure.com/en-us/manage/windows/common-tasks/install-sql-server/ and created the necessary endpoints:
Somehow, I can't connect to the SQL Server, getting this error
Cannot connect to xxx.cloudapp.net.
ADDITIONAL INFORMATION:
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: 53)
The network path was not found
I already tried to temporary disable the windows firewall on the vm - without success. Any suggestions?
I had the same problem, this troubleshot helped me getting close to the solution:
Use SQL Server Management Studio to connect remotely to an SQL Server Express instance hosted on an Azure Virtual Machine
Summing up, what i did, i don't know if all these steps are necessary, so you should test after each one:
1) In SQL Server configuration manager enable Named Pipes in protocols
2) In the VM add a windows firewall inbound rule for sql server port (in my case the default 1433, in yours it seems to be 1435, make sure it's 1435 in sql server configuration)
3) Make Sure you are using a sql server authentication login (not a windows authentication) if you don't have one create it locally in the VM>MSSMS
4) Make Sure the SQL server is configured for mixed authentication (http://www.katieandemil.com/microsoft-sql-server-error-18456-login-failed-for-user)
5) Make sure sql server browser is running
Hope this helps :)

Cannot connect to sql server

I cannot connect to Sql server remotely from management studio , It is corrrect User name and password, but
how to enable remote connections to a sql server?
what is other chances?
Cannot connect to xxxx.xxxx.xxxx.xxxx
===================================
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) (.Net SqlClient Data Provider)
thanks
Check out surface area configuration. It gives options to do so.
Edit: Enable the Named pipes conenction as well. I guess you are using Named pipe to connect. Also check if the SQL server browser service is running on the DB server.
Check the Authentication mode settings. It may be set to Windows Authentication only, it needs to be in Mixed Mode to accept SQL usernames & passwords.
Also check the Server network configuration and make sure named pipes or tcp/ip are enabled add that the client is using the appropriate protocol.
If everythings are correct, you may want to connect with a upper version, for example you are in SQL Server 2005 and want to connect to SQL Server 2008.
Note that you cannot connect to a upper version.(only same version or older version are granted)

Resources