JDBC inactivity timeout (MS SQL Database) - sql-server

On my setup with a JDBC driver that connects to a Microsoft SQL Server 2019 database, I experience the following "connection broken" error if there is more than ~12h inactivity.
The error is:
The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.
How to extend that inactivity timeout? Is it a setting of the MSSQL server?
Trying to find an appropriate setting for the JDBC connection. I could not find any.

Related

MS Access front end to SQL Server intermittant ODBC connection issues

We have a MS-Access front application using data from a SQL server back-end. We are using ODBC connections for the data communications. The application randomly getting frozen or crashes giving different errors as attached below which very likely seems to be issues related to ODBC connection. Problems can be recreated by running different queries in quick successions.
SQL Server Version: SQL Express 14.0.3356.20
Access Version: Microsoft 365 Apps for Business Version 2011 (Build 13426.20204)
Most common error codes:
10054, 10060, 3146, 3151
ODBC Data Source Type: System DSN
ODBC Driver: ODBC Driver 17 for SQL Server (Version 2017.176.01.01)
Example Connection String for a linked table: ODBC;Description=Test Description;DRIVER=ODBC Driver 17 for SQL Server;SERVER=MY-SERVER;UID=MyUser;Trusted_Connection=No;APP=Microsoft Office;DATABASE=TestDatabase;;TABLE=dbo.TableName
Largest Table Size: 53000 records (Doesn't really matter, fails for even smaller queries, but if you try faster getting results from different queries you can break it)
Error1 Error2 Error3
We have gone through hundres of searches/articles about these and applied the fixes listed below, but still couldn't get the problem solved.
We have tried below solutions as of now which didn't help.
Created firewall rules (Inbound - TCP Port 1433, Outbound - TCP all
ports)
Added TCP Port 1433 - TCP/IP protocol
Enabled Namepipe
Updated SQL Server Express from 14.0.3335.7 to 14.0.3356.20
Made IP4 and IP6 are both enabled
Enabled and checked ODBC Trace Logs
Checked Windows Event Logs
Hope I have included everything that might be useful to get some help resolving this issue.
Note: Not sure if it's related, but the SQL Server itself (in the backend) giving the below error in rare occasions if it helps.
Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=29278; handshake=26244; (.Net SqlClient Data Provider)
Thanks everyone who tried to help. This issue has now been fixed.
For anyone who will come here in future looking for a solution for a similar issue, below is what worked for us.
Added a new instance of SQL Server 2019 (in the same virtual machine
which 2017 sits on)
Enabled UDP Port 1434
Changed virtual port from blank to zero
2017 was still crashing before taking offline with the same settings.
No issues with the 2019 version.

HTTP Error 500.30 - ANCM In-Process Start Failure - An error occured during migration

I have read this thread, however unfortunately couldn't find the solution to my problem. I have an ASP.Net Core project (that's called Rent) and it works without any problem on my local machine. However, once I publish the project to the IIS (still in development mode) I get the below error
fail: Rent.Program[0]An error occured during migration
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: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
---> System.ComponentModel.Win32Exception (0x89C50118): Unknown error (0x89c50118)
The connection string is called DefaultConnection and is the environment variable. Can anyone help me please? Can provide any additional information if required.
The first thing you should check is that your SQL Server instance is up and running and that your database is still available. This error means quite literally that it can't establish a connection to SQL Server from the Secret Server application.
And you can also check follow things in your environment:
Is something blocking the connection between your Secret Server server and SQL Server?
The standard SQL port is 1433. Check with your server administrator - is the Windows Firewall in use, blocking this port on your SQL server? Check with your network administrator - is there a firewall at some point in between that has closed off this port? Keep in mind that if you use a custom port for SQL, it need to be specified the Secret Server database connection using a SQLSERVER,port type of format.
On the server hosting your SQL Server database, is the SQL Server
service running?
Open services.msc or SQL Configuration Manager to view the status of your SQL Server service.

Unable to connect to another connection in SSAS Tabular

I have a very weird issue with SSAS Tabular connecting to a SQL Server source database. I've spent almost the entire day on this, and searched online in various ways to find a helpful answer, but none of the suggestions solved this mysterious problem for me.
It used to work fine, but I tried various connection settings (Windows vs SQL authentication, and different impersonation modes), but now I no longer can get it to work (even if I revert back to the previous bim file in source control).
When I process a table from the WORKSPACE database (through SSMS), it works. But when I process a table from the DEPLOYED database (still through SSMS), it does NOT work.
The connection I am using is:
-SQL Server Native Client 11.0
-Windows Authentication
-Impersonation mode of a Windows account (which has the appropriate permissions)
The source database is in a SQL Server database located on a different server (but in the same network).
I have searched everywhere online, but didn't find anything that could help me.
I have tried changing the connection driver (OLE DB Provider for SQL Server), and I have restarted the SSAS Tabular service.
The full error message I get when trying to process a table on the deployed database is:
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: Login timeout expired; HYT00; 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; Named Pipes Provider: Could not open a connection to SQL Server [5]. ; 08001.
A connection could not be made to the data source with the Name of 'DataWarehouse'.
'.
In fact, after I tried a second time to restart the SSAS Tabular service, the error message I get after attempting to process a table is slightly different:
Failed to save modifications to the server. Error returned: '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; SSL Provider: The requested security package does not exist
; 08001; Client unable to establish connection; 08001; Encryption not supported on the client.; 08001.
A connection could not be made to the data source with the Name of 'DataWarehouse'.
'.
According to your description, it seems to be related to connection problem. You need to check whether corresponding SQL server service and SSAS Service is running(check server which contains "DataWarehouse" is running and can be connected). You could go to "SQL Server Configuration Manager " to restart them.
In addition, you also need to make sure your current windows credential can access this database(if you use window credential). And check whether this server enable remote connect.
Zoe

SQL Server Exception

My requirement is simple: I have an appserver - WAS 6.1 connecting to Microsoft SQL Server 2008 R2.
I have configured data source for the SQL server using the installation scripts in linux.
When I deployed EAR and try to hit application url, I get the below error while connecting to SQL Server.
com.ibm.websphere.ce.cm.StaleConnectionException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: SQL Server did not return a response. The connection has been closed..CWWRA0010E: SQL State = 08S01, Error Code = 0
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
The setup is working for another server configuration.
After a long wait, the issue got resolved. There is nothing to do with the EAR. The SSL encryption was enabled in SQL server settings. Just disable the settings did let me establish connection from application to the SQL server.

Why are the ODBC queries from my desktop is blocked by the sql server after running several queries in rapid succession?

I usually create queries using Visual Foxpro 9.0 from a desktop computer to a MS SQL Server 2005 running on Windows Enterprise Server (2003). My queries are repetitive and sometimes, one session would query the SQL server 200,000 times in rapid succession. For the first few days, my program is running fairy well but then suddenly the SQL Server is refusing to process the queries.
On checking the logs in the SQL Server, I found out that a certain spid is killing my query process:
Process Id 71 was killed by Hostname SQLSERVER, Host Process ID xxxx.
I am confused because the hostname is not the SQL Server I am querying but another SQL Server.
From the activity monitor I noticed that the offending Process ID has the following information:
62 NO sa master sleeping 0 AWAITING COMMAND Sql Agent - Generic Refresher ..
The details shows a message:
SET NO_BROWSETABLE ON
Lastly, thinking that it may be a problem with visual FoxPro, I tried running queries from the desktop machine from within SQL Server Management studio, I still encountered the same problem when I tried queries to the SQL Server:
A transport-level error has occurred when sending the request to the
server. (provider: TCP Provider, error: 0 - An existing connection was
forcibly closed by the remote host.)
It's mind boggling because I am able to establish connections but my queries are refused by the server. Again, thinking that my desktop is the problem, I tried running the queries from another computer. It was running at first then suddenly the same problems occurred. Now these two desktops are refused by the server.
I am thinking that this might be a security but I don't know how to resolve this problem.
We also tried to restore our database backups to another host, the same scenario happened... Fine at first then the problem appeared after a few query sessions.
The following are the ODBC SQL Server Drivers:
Microsoft Ole DB Provider for Sql Server
Sql Server Native Client 10.0
Sql Server Native Client 11.0
I have search the web for a possible solution and I tried the suggested solutions, spid blocking, chimney offloading, rss, among others but to no avail. Please, In need your expert advise!
Thank you in advance.

Resources