System DSN ODBC connections working initially but failing after at least 4 hours - odbc

I am trying to migrate data from our Enterprise Data Warehouse to one of our own reporting databases via ODBC and Python scripts. The python scripts import pyodbc to handle the database connections and execute SQL queries. A system DSN is defined on our ETL server for each database involved in the process.
Enterprise Data Warehouse (Data Source)
ETL Server - Windows Server 2016 with SQL Server 2016 instance
Reporting database (Data Destination) - Windows Server 2016 with SQL Server 2019 instance
When the ETL server is freshly rebooted, all the scripts successfully execute and transfer data as expected. After a number of hours though one of the connections no longer works until a system reboot is performed. Rebooting the ETL server before every scheduled ETL job isn't ideal and I would like to have these connections persist without a reboot.
Here is the error
[Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. (53) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0); [08001] [Microsoft][ODBC Driver 17 for SQL Server]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. (53)')
I tested each of the DSNs using ODBC Data Source Administrator (64-bit)
DSN for EDW connectivity test successful
DSN for ETL connectivity test successful
DSN for Reporting database connectivity test failed
Even when the scripts throw errors and the connectivity tests fail
I am still able to remotely connect to Reporting Database in SQL Server Management Studio and execute queries
The Reporting Database server also remains accessible via Windows Remote Desktop Connection so its not powered off or unavailable on the network.
Once the ETL server is rebooted, the DSN connection tests succeed and everything returns to normal for a few hours.
This problem also occurs with OLE DB connections defined in SSIS packages, which is why I'm trying python and ODBC for this project. Turns out I'm running into the exact same issue. The SSIS errors are also driven by the Connection Manager for the Reporting Database.
I have full administrative privileges on the ETL server as well as the Reporting Database but I am in an Enterprise environment and lack privileges to administrate networking.
Please let me know what other information would be helpful to diagnose and troubleshoot this problem.
Thanks in advance!

Related

Is there a way using runas command to remotely connect to SQL Server (external domain) and try debugging production code (internal domain)

I am setting up a process and environment to debug production issues. The problem we have is that the developers are contractors (different domain) and use Visual Studio to connect to our SQL Server databases (in our domain). We are facing connection issues in code.
Tried: while we are able to launch Visual Studio using runas /netonly switch, but while debugging, the database is not connected. Please refer to the attached diagram below for better understanding.
Error:
Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
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

connection string for classic asp application using odbc 11 for sql server

We have a classic asp application, we lost connection with the database. In application server we are able to connect to database only through odbc driver 11 for sql server. Have tried other native client drivers to establish connection which remained unsuccessful. The only supported driver is odbc 11 for sql server.
Have tried following connection strings -
ODBC Driver 11 for SQL Server:
{"Driver={ODBC Driver 11 for SQL Server }; Data Source =servername; Initial Catalog= dbname; Uid=username ; Pwd=password; "}
DSN:
{" DSN=dsnname;Uid=username ; Pwd=password; Database=dbname"}
Still unable to establish connection.
Can you please suggest the connection strings for odbc driver 11 for sql server?
The is an MS fix for these symtoms here https://blogs.msdn.microsoft.com/sqlreleaseservices/tls-1-2-support-for-sql-server-2008-2008-r2-2012-and-2014/
Issue described as below. The list of items fixed includes SQL Native client and ODBC client.
SQL Server Management Studio (SSMS), Report Server, and Report Manager don’t connect to the database engine after you apply the fix for SQL Server 2008, 2008 R2, 2012, or 2014. Report Server and Report Manager fail and return the following error message:
The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. (rsReportServerDatabaseUnavailable)
This issue occurs because SSMS, Report Manager, and Reporting Services Configuration Manager use ADO.NET, and ADO.NET support for TLS 1.2 is available only in the .NET Framework 4.6. For earlier versions of the .NET Framework, you have to apply a Windows update so that ADO.NET can support TLS 1.2 communications for the client. The Windows updates that enable TLS 1.2 support in earlier versions of .NET framework are listed in the table in the “How to know whether you need this update” section of KB3135244.
Found as to[ Google hit searching for https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=oledb+tls1.2 - there are many more interesting-looking hits in the top ten there that should get you going.
Please come back and self-answer if this solves your issue and there were any other peculiar or unexpected mods you had to make.

Connection issue between Asp.Net 4.5 app and SQL Server 2012

I have a web forms application that is connecting to a SQL Server 2012 database. When I try to open the connection within the app I get this error:
System.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: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) ---> ...
I've checked and SQL server is configured to allow remote connections, TCP/IP is enabled, the server is up and I can connect to it via SSMS and Linqpad.
This is occurring when I run the application locally, hitting a local database. I know the connection string works, as I can use the login in SSMS to login and I have a linqpad query that is working with no problem using the same connection string. Also the error occurs when I try to open the connection (i.e. the connection is created successfully).
I'm guessing there is some access/security issues with my configuration of IIS, but I not finding it.
After a couple of frustrating days, I discovered the solution. The problem was that SQL server wasn't setup to use TCP/IP. This is configured in the Sql Server Configuration Manager, under the SQL Serer Network Configuration node, then Protocols for MSSQLSERVER. Make sure TCP/IP is enabled.

How to take backup of sql server 2012 database from network computer

I'm using sql server 2012 and windows server 2008 R2 on my server machine.
And windows-7 and sql server 2012 on network computers.
I were made a user for sql server 2012 (server machine).
From that user i am able to connect with the database server from remote computer.
Now i need to take backup of any database from network computer using this user(Sql server authentication).
Query for backup
Backup database hwbss to disk = '\Dpc1\SqlBackup\hwbss.bak';
When i run this query on both machine server and client.It troughs error.
Error message
Msg 3201, Level 16, State 1, Line 1
Cannot open backup device '\\ASHISHRATHOR-PC\SqlServerBackup\BSS100_Ashish_BSS.bak'.
Operating system error 5(Access is denied.).
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
Can any one tell me how can i take backup of sql server 2012 database from network computer using sql server authentication.
Note:- I am able to take backup of database on network in sql server 2005.
I think this can be done by using Map Network drive. You have to create such drive to the remote folder that you want to store the backup. Then you have to give sql server permissions to see the network drive. Check in task manager which is the account the sql server is running on. You must grant write permission on this account to the network drive(usually it's Network Service).

Cannot connect to SystemDSN ODBC datasource IIS 7

I have configured odbc datasource as System DSN.
It works fine by itself and from Visual studio.
When I try to start applicattion under the IIS 7 on connection I get an error:
ERROR [08001] [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [5].
ERROR [HYT00] [Microsoft][SQL Server Native Client 10.0]Login timeout
expired
ERROR [08001] [Microsoft][SQL Server Native Client 10.0]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.
IIS Application runs as different user - this user has no access premonitions to somewhere that ODBC uses.
I changed ApplicationPool identity to ran as administrator - this solved my problem. This was the fast solution. At least this is dirrection to dig. :)

Resources