I'm trying to connect to a local SQL Server Express database using EF Core with this connection string:
"Server=(localdb)\\WIN-R84DEUE96RB\\SQLEXPRESS;Database=rmcsql;Trusted_Connection=True"
I get this error:
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
An error occurred using the connection to database 'rmcsql' on server '(localdb)\WIN-R84DEUE96RB\SQLEXPRESS'.
fail: Microsoft.EntityFrameworkCore.Query[10100]
An exception occurred while iterating over the results of a query for context type 'RMC_IEM.DataStore.EF.ApplicationDBContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904): 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: SNI_PN11, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)
What is wrong with this connection string?
I was trying to create a linked server from an on-premises SQL Server (BadMachine1), to an Azure SQL Server.
Code for creating the linked server
EXEC sp_addlinkedserver D365BI_Testing, '', 'SQLNCLI11', #datasrc='blabla.database.windows.net', #catalog = 'DbName'
EXEC sp_addlinkedsrvlogin D365BI_Testing, 'false', null, 'blabla_Admin', 'thepassword'
Created fine, but when testing connection on BadMachine1, this error message:
TITLE: Microsoft SQL Server Management Studio
------------------------------
The test connection to the linked server failed.
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
TCP Provider: The specified network name is no longer available.
Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server.
OLE DB provider "SQLNCLI11" for linked server "D365BI_Test2" returned message "Client unable to establish connection due to prelogin failure".
OLE DB provider "SQLNCLI11" for linked server "D365BI_Test2" returned message "Client unable to establish connection". (Microsoft SQL Server, Error: 64)
For help, click: https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-64-database-engine-error
------------------------------
BUTTONS:
OK
------------------------------
OK, tested on two other machines we have (GoodMachine1, GoodMachine2) - all of these are in the same data center. The test connection succeeded on both GoodMachine1 and GoodMachine2, and I could successfully write a query from Goodmachine1 and GoodMachine2's SQL Server, to the Azure SQL Server.
Next test:
Tried logging into each of the 3 machines, and opening up SSMS to try to connect to the Azure SQL Db. Connection worked on GoodMachine1 & GoodMachine2. Failed on BadMachine1, with the following error message.
TITLE: Connect to Server
Cannot connect to blabla.database.windows.net.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
------------------------------
The specified network name is no longer available
------------------------------
BUTTONS:
OK
------------------------------
I don't have access to check, but I'm told the firewall rules are OK on the Azure side.
There are some characteristics that differ among the 3 machines:
BadMachine1: ODBC Driver 11, old "Microsoft AS OLE DB Provider for SQL Server 2014". SQL Server 2014
GoodMachine1: ODBC Drivers 11, 13, 17, no OLE driver. SQL Server 2016
GoodMachine2: ODBC Driver 13, recent install of OLE driver. SQL Server 2016
Could the old ODBC driver on BadMachine1 be it? Other ideas? Apologies in advance, I've never tired to setup a linked server before, and don't really know what I'm doing very well.
Turns out our IT was blocking those outbound connections from BadMachine1. Now that they're unblocked, the linked server works fine.
I am trying to connect from my SSAS server to SQL through SSMS and the connection works fine when I test it. But when I am processing the cube, I am getting the below error message.
OLE DB error: OLE DB or ODBC error: 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.; 08001; Client unable to establish connection; 08001; Encryption not supported on the client.; 08001.
I have looked the other similar error message that was posted and tried the below options as per the suggestions.
SSAS - OLE DB error in establishing a connection
1. Restart SSAS Service
2. Restart SSAS using local system
3. Trying to change the Provider to Native OLE DB\Microsoft OLE DB Provider for SQL server, but still I am getting the below error
OLE DB error: OLE DB or ODBC error.
I am stuck with this for more than 3 days and not able to progress anything beyond. I tried all other Providers as well and still it doesn't work.
Additionally I made sure that the Windows account I am using in data source of SSAS server is having db_owner on the SQL data base.
Any help would be really appreciated to get me out of this.
I was able to get a solution for this upon trial and error method for selecting the below changes. I have tried to set the
1. Provider as "Native OLE DB/Microsoft OLE DB Provider for SQL Server"
2. Changed the connection from Windows Authentication to SQL connection.
3. The type of Impersonate Account from Windows Authentication to Authenticate by Service Account.
Once the above settings were done, I was able to process the Cube.
Going to receive data by linked server in MSSMS. Now I can connect to server by Connect -> DB Engine. By this type of connection all OK - can see all data. When I try to create linked server has Error
OLE DB provider for linked server returned message "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. …
This is the server description problem to which I want to connect, or it is restrictions on the access protocols or some thing else for the local server?
I have an sql server and its been installed as new instance called instance2 . Now when i tries to open MSDB folder under stored packages this gives me below error
TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
The SQL Server instance specified in SSIS service configuration is not present or is not available. This might occur when there is no default instance of SQL Server on the computer. For more information, see the topic "Configuring the Integration Services Service" in %SQL_PRODUCT_SHORT_NAME% Books Online.
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]. (MsDtsSrvr)
------------------------------
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]. (Microsoft SQL Server Native Client 11.0)
------------------------------
BUTTONS:
OK
------------------------------
Also Once i tried to open the package from visual studio it returns the below error
TITLE: Add Copy of Existing Package
------------------------------
An OLE DB error 0x80004005 (Login timeout expired) occurred while enumerating packages. A SQL statement was issued and failed.
------------------------------
ADDITIONAL INFORMATION:
An OLE DB error 0x80004005 (Login timeout expired) occurred while enumerating packages. A SQL statement was issued and failed.
------------------------------
BUTTONS:
OK
------------------------------
i have two instances: Adventure and instance2 also I added instance name in msdtsrvr.ini but it didn't fix the issue
thank you
The ssis service does not support multiple instances. SSIS will be configured to managed packages on the first instance installed on the machine or the default instance. There is some more information about that here:
https://msdn.microsoft.com/en-us/library/ms137789.aspx
This applies to versions < 2012. 2012 and up support this storage model for backwards compatibility or you could convert to the project deployment model.