SQL server periodically gets disconnected - sql-server

Our environment is:
Windows Server 2003, Service Pack 2
SQL Server Express 2005
SQLServer JDBC driver 1.2 (also tried Jtds)
Sun JDK 1.6 (we tried this on JDK 1.5 as well)
There is no virus protection software on the host, and no firewall is enabled.
We have Web application deployed in JBOSS 4.0.2.
Our problem is that the JDBC connection to SQL server periodically gets disconnected, and then we can't reconnect to the database at all, unless we physically restart the server on which JBOSS deployed.
we are getting following error in log.
Software caused connect on abort: recv
failed
Note: We are able to connect to database using sample java test class.
Any suggestions would be most appreciated, as this is a serious, mission-criticial problem for us right now.

Can you access the SQL Server using Management Studio? If so how many connections are open?
Do you close your connections after querying?
What does the Task Manager tell, service still running; mem/cpu usage.
Its a long shot but do you have enough disk space on C: and data-drive?

Related

Failure while connecting to SQL Server: “The driver received an unexpected pre-login response”

I have a web application that, alongside a Windows Service, connects to a MS SQL Server 2017 using Hibernate. This connection have already been tested and executed correctly in previous situations, that is, compatibility between driver and server are fine. Despite this, I'm having trouble doing a particular connection to a new, remote SQL Server (note: remote SQL connections were already successfully done in the past).
So this remote SQL Server 2017 is located in a cloud server. In my PC, I have NetBeans running the tested web application. In another server, but in the same network, I have my Windows service installed.
With the Windows service, I'm able to connect to the server in the cloud. If I run it in inside the cloud server, it connects to it as well. I'm also able to connect to it using Microsoft SQL Management Studio, both from within the cloud server as well as from my PC. In other words, I'm perfectly able to connect to the server thus I have the correct connection informations.
The only exception here is my web application; it just won't connect. And when it fails to do so, it throws this error message: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later."
Here is Hibernate configuration (remember: I was previously able to connect to remote SQL 2017 servers):
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://ip.goes.here\MARTIN2:1521;databaseName=DATABASENAMEHERE</property>
<property name="hibernate.connection.username">login</property>
<property name="hibernate.connection.password">password</property>
Since this problem was occurring, I tried lots of other possible combinations of configuration in the code above and none of the was successfull.
So why is this happening? The only extra stuff that maybe could explain this is that in the same cloud server there is another Oracle server installed. Nevertheless I don't believe this is the problem since, as I mentioned, both MS Studio as well as the Windows service are able to connect without problem. Driver is mssql-jdbc-7.0.0.jre8.jar. This web application connects fine in another SQL Server installed in a different machine in the network (the same mentioned above from where the Windows service connectin was tested), testifying once again driver compatibility is fine.
I managed to find the answer to the problem.
First, I needed to take out the port information. It seems that the installation of the SQL server was somewhat buggy and therefore the default 1433 port wasn't used, but rather some other I still don't know yet. So removing the specific call to use 1433 solved the connection error. (Note: in the above code I use 1521 because the Oracle server in the same machine was using this port and I previously mistakenly though the same port was going to be used; only later I noticed it was my mistake).

Remote SQL Servers unavailable after installing Visual Studio 2012

I just built a new machine after my old one crashed a few days ago. I'm running Windows 7. I installed SQL Server 2012 Express as well as SQL Server Development Edition with Tools.
After installing, I made sure I could connect to both the Express version, local Dev server as well as multiple remote servers. Everything was great.
This morning, I installed Visual Studio 2012. Since doing this, I can still connect to my Local servers (Express and Dev), but I can't connect to the remote servers. The error I get is this:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.) (.Net SqlClient Data Provider)
I've searched for issues, and while I've found some similar to this, not many mention Visual Studio, and none offer a solution.
UPDATE
I found I can connect using Named Pipes. The problem then is that not all my servers are configured to allow Named Pipes.
Visual Studion Connection Related Error:
netsh winsock reset
Run this command in command prompt. That will Fix Connection Related Error in Visual studio 2012
I think you'll need to look in your SQL server configuration manager and make sure TCP/IP is enabled for the database instances your interested in.
It isn't by default if I remember rightly.
If you're ok locally, have you read this post?
An error occured during the pre-login handshake
As other users are experiencing this problem, I thought I would add the solution I found.
The utility lspfix.exe found a break in the Layered Service Provider (LSP) chain. I applied the recommended fix and I was up and running again.
The fix was recommended by the lspfix.exe application. It's a very simple tool to use and it found the problem quickly. Here is the url to the tool.
http://www.cexx.org/lspfix.htm

SQL server cannot be connected

I am developing an Asp.net MVC4 application wherein i am using SimpleMemberShip provider for authorization and i am using database MSSQL Server 2012 on the same machine.
When i openup the SQL server management studio and connect to the database by using windows authentication and sql server authentication, in both ways it is getting connected.
But when i am specifying the connection string in the application with correct credentials,
Still the application is unable to connect to the database.
I have restarted the system but it did not resolve the issue.
I have opened the configuration tool of SQl server and enabled TCP\IP and namepipe client protocols for sql client as well as for the server and restarted all the sql server related services.
But still issue is remaining, i am sure about connection string it is 100% correct.
I am scratching my head from past 5 hrs but could not track down the issue.
Please tell me the possible solutions.
I would check firewall. If you have firewall (either default windows or using some AV) then temporarily disable it and see if it works.

General Network Error when connecting to SQL Server using WinCE Motorola devices

I get the Exception: "General network error. Check your network documentation." when connecting to our new SQL Server 2008 R2 server. Nothing more that that I can tell about the exception.
In windows CE5 or CE6 (depending if using Motorola MC3090 or MC3190), Microsoft SQL Client 2.0 is installed (package sql.wce5.armv4i.CAB get deployed when running the application from Visual Studio 2008). I’m not able to connect to that DB on both version of the gun… I’m only able to connect with our Windows applications (x32 and x64). The connection string I use is the following: "Data Source=ip_address;Database=dbname;User ID=username;Password=password"
I successfully connected to a dev database in our LAN. The dev database server is also 2008 R2 SP1 but there are no port block (wide open). Apparently, nothing is blocked according to the sys admins. The new DB server is now virtual and remote.
Is it possible there is some kind of options to prevent connections from some sources? Is there any diagnostics tools I can use?
Any ideas beside that?
Thanks
That was finally my fault. When testing I left the gun on the cradle and connection failed that way... I needed to test with the gun not on the cradle using its wireless connection and it worked!

MS Access 2003 + linked tables to SQL Server 2005 + Windows Authentication = slow

Our MS Access application with linked tables to SQL Server 2005 is slow when using Windows Authentication from Windows XP clients.
We've been running it successfully using SQL Server authentication, but now we want to move to Windows Authentication for better security control.
Setup:
Database server: Windows 2003 Server, SQL Server 2005 SP2
Client: Windows XP SP3, SQL Server ODBC driver v2000.85.1132.00
MS Access application: MS Access 2003
Connection string:
DRIVER=SQL Server;SERVER=[server name];Connect Timeout=300;Trusted Connection=True;APP=Microsoft Office 2003;WSID=[server name];DATABASE=[db name]
Only the TCP/IP network protocol is enabled on the server.
The slowness does not happen in these situations:
App on DB server, SQL Server Authentication
App on DB server, Windows Authentication
App on Windows XP client, SQL Server Authentication
SQL Server Management Studio on client, Windows Authentication - I did a small test with running 15 queries in SQL MS. This went fast and did not cause any logon/logoff events in the Security event log on the server.
I've analyzed the slowness using SQL Server Profiler and the event log on the server and it seems to come down to this:
The application runs a query
A new connection to SQL Server is opened (visible in SQL Server Profiler)
The identity of the user is verified (visible in the Security event log on the server, a logon/logoff event happens). This takes several hundreds of milliseconds.
The query runs on SQL Server
Results are returned to Access
This happens for every query. Some of the forms run +- 10 queries when showing a new record (updating sub forms, loading values for combo's etc). This results in very slow performance.
Of course setting up a new connection to SQL Server for every query isn't necessary, and reusing connections might solve the issue. I've been looking around for information on how to make sure Access/ODBC does proper connection pooling. I found these MS KB articles:
Frequently Asked Questions About ODBC Connection Pooling
How to Enable Connection Pooling in an ODBC Application
I've tried calling the SQLSetEnvAttr function from the main form of the Access application, but this didn't improve results.
Any help is greatly appreciated.
The first question I have is: are you running a domain controller? This may sound like a crazy question, but I just want to make sure. Although is less and less common, I've seen organizations run Windows networks with workgroups and "pass-through" authentication. The symptoms you describe are the same as would be observed on a network that is set up in this fashion.
Assuming you do have a proper domain set up, you must have a problem somewhere in the Named Pipes network stack. Named Pipes is the default protocol if you're using Windows authentication. It's not a bad idea to get to the bottom of this if you have the time, but if you just want to fix your performance problem, then I would force the TCP/IP protocol in your connection string:
DRIVER=SQL Server;SERVER=tcp:[server name];Connect Timeout=300;Trusted Connection=True;APP=Microsoft Office 2003;WSID=[server name];DATABASE=[db name]
Note the addition of the tcp: prefix. I got this syntax from Jon Galloway's blog. TCP/IP is the default protocol for SQL Server Authentication. You can also make the protocol switch by disabling Named Pipes support on the server, but this is more of a hassle and could cause other unanticipated problems.
Check Microsoft SQL Server Native Client
at http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en

Resources