VB.NET application not using failover partner - vb.net

I have a VB.NET app that connects to a SQL Server.
We recently added database mirroring in case of a server failure.
Well of course, our SQL Server failed but the VB.NET app is not failing over.
I found that in our code, a failover partner wasn't specified in the connection string so I updated the connection string as follows:
sConnectionString = "Data Source=PROD-SQL;Failover Partner=FAILOVER-SQL;Initial Catalog=DB;User ID=****;Password=******;"
The SqlClient.SqlConnection object accepts this connection string but when I call its .Open() command it fails with the following error:
"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)"
Why is this? Our intranet apps failed over just fine (Classic ASP using DSN-less connections).
Does the application have to make at least one successful initial connection to the primary server before it can failover successfully?
Thanks!

Run this on your principal db
SELECT DB_NAME(database_id) AS 'DatabaseName'
, mirroring_role_desc
, mirroring_safety_level_desc
, mirroring_state_desc
, mirroring_partner_instance
FROM
sys.database_mirroring WHERE mirroring_guid IS NOT NULL;
The value returned in mirroring_partner_instance is the server name that will be used by your connection for failover, not FAILOVER-SQL. FAILOVER-SQL will be used when it first tries to get a connection but cannot contact PROD-SQL. If PROD-SQL is available the failover partner will be set in cache from the sql server value mirroring_partner_instance.
See here for more info: http://blogs.msdn.com/b/spike/archive/2010/12/15/running-a-database-mirror-setup-with-the-sqlbrowser-service-off-may-produce-unexpected-results.aspx

Related

OLEDB Connection to Azure SQL fails: Named Pipes Provider: Could not open a connection to SQL Server

We have an application that connects to an Azure SQL database with a connection string like
Server={ServerNameHere}.database.windows.net;Database={DatabaseNameHere};etc.....
Our application normally connects using TCP/IP, and the same connection string works perfectly fine from several other machines. Just not for this one client PC.
The error it returns is
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessable. Check [etc]
followed by:
Named Pipes Provider: Could not open a connection to SQL Server [53].
This is the bit I don't understand. Our connections are made over TCP/IP so why is it showing a message that mentions Named Pipes Provider?
The fact that the connection to the same database, with the same credentials, works fine from other client PCs leads me to think that the problem is not at the Server end (Azure).
But if it's at the client end. What do I need to look for on the Client PC?
I am having asp.net app and I try to connect my Azure SQL database to my app by using my connection string.
Connection String:
Server=tcp:<server>.database.windows.net,1433;Initial Catalog=<db>;Persist Security Info=False;User ID=<username>;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
I try to connect to database but I got below error:
In my case at that time, I connected to my office Lan network I removed that, and I connected to my personal hotspot and tried again it connected successfully.
The error regarding Named Pipes Provider enable Named Pipes in SQL server configuration manager.
SQL server configuration manager-->SQL Native Client-->Client Protocols-->Named Pipes
It may reduce the error.

Cannot connect to ANY remote SQL Servers from my system

I cannot connect to any remote SQL Server instances from my system. I used to connect them from SQL Server Management Studio. Moreover, I can still connect to the same SQL Servers remotely from another systems (my colleagues' system).
I am getting following error:
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)
Error Number: 53
Severity: 20
State: 0
I have checked:
Named pipes/TCP is enabled.
Remote connections are allowed.
Windows Firewall is off.
Enabled everything in SQL Server Configuration Manager.
Also, I have tried everything mentioned in this post-
How do I fix the error 'Named Pipes Provider, error 40 - Could not open a connection to' SQL Server'?
But still could not solve my problem. Please suggest any method which allows me to fix this error and connect to the remote servers again.
instead of check whether that server system is working or not, because sometimes if the server system is not working means we are unable to connect to that system

Processing SSAS Tabular model Fails Remote Server

I'm trying to create a SSAS Project and deploy to a remote server.
The Data Source is a Database in the same server, but the project must be made in my laptop.
The remote server is not in a domain environment, so to login in SSAS, I used runas /netonly mothod using Server's Administrator Account, which works fine to connect to SSAS Server through SSMS.
I created SSAS Project using Workspace Server and connection is successful.
I am also able to connect to same Server using SQL Server Database Data Source, using Impersonate Service Account, but after I select the tables I need, the processing fails and gives me this Error:
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error] Microsoft SQL: 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: TCP Provider, error: 0 - The wait operation timed out.).
And as result I get all tables without data, just column names.
If I create a project using Integrated Workspace, I am able to get Data from Source, but the same Error occurs when I try to Deploy the Project. The metadata deploys successfully, but all processing fails with the same Error.
I tried to Increase Timeout, but the same thing happens even after waiting 30 minutes.
This process does not fail if I create and execute the project inside the Server.
Enable the TCP/IP in both Server NetWork and Client protocols;
Set TCP port:1433;
And then try it again.
Please reference this: troubleshoot-connecting-to-the-sql-server-database-engine

Error connecting to new sql server

I am facing problem in registering new sql server instance SQLEXPRESS in SQL Management studio 2008. when I try to connect or test the server error message appear,
I am also facing facing same problem in any new server irrespective of the name, except the main one which was created at the time of installation and which was named same as my user ID in windows..
TITLE: Microsoft SQL Server Management Studio
Error connecting to 'SQLEXPRESS'.
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)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=53&LinkId=20476
are you using windows authentication or sql server authentication
if you are using windows authentication then you have to give the sql instance name
which sql provide by default .
if you using sql authentication then u must use the username and password which
you provide during setup

Can Not connect to Remote SQL server named instance with port

Hi All We have a server where we have sql server 2008 as well as SQL server 2005 hosted on port 1444. Using SSMS, I am able to connect to 2008 instance without any problem. But when I try to connect to 2005 instance using following connection settings.
DEVDB1\SQL_2005,1444
SQL server authentication user name and password.
I get following error
"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: TCP
Provider, error: 0 - A Connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connection host has failed to
respond)(Microsoft SQL Server, Error: 10060)"
I am able to connect to another instance on the same server. but not this.
NOTE: My colleagues are able to connect to this sql server with the same settings. It just does not work from my machine. Me and all my colleagues are working on VPN and have same machine configuration.
Is there any setting that I need to do/check to get successfully connected?
My VPN user profile was restricting access to this perticular port. Once my VPN user profile is matched with those who were able to access, the problem resolved.