jdts – Error – “I/O Error: DB server closed connection” – Day 02

Background

In our previous post we laid the foundation of a somewhat perplexing issue that we ran into.  The error read “I/O Error: DB server closed connection”.

Troubleshoot

Let us troubleshoot more.

Errors

Network Connectivity Error

If one lacks basic network connectivity here is the error.

Image

dbeaver.2018121.0804

Textual

Login timed out.
connect timed out

Error :- Socket Closed

One can also get an error that simply states “Network error IOException : socket closed“.

Image

dbeaver.socketClosed.20181221.0811AM.PNG

Textual

Network error IOException: Socket closed
Socket closed

Dbeaver

Dbeaver Log

dbeaver-dbeaver.log

 

Text


2018-12-21 08:09:29.685 - Connect with 'sql03' (mssql_jdbc_jtds-167cd7b7762-272567fd541ba2d9)
2018-12-21 08:09:49.699 - Connection failed (mssql_jdbc_jtds-167cd7b7762-272567fd541ba2d9)
2018-12-21 08:09:49.702 - org.jkiss.dbeaver.model.exec.DBCConnectException: Network error IOException: Socket closed
org.jkiss.dbeaver.model.exec.DBCConnectException: Network error IOException: Socket closed
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:179)
	at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:126)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:86)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:86)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.(JDBCRemoteInstance.java:54)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeRemoteInstance(JDBCDataSource.java:105)
	at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.(GenericDataSource.java:108)
	at org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource.(SQLServerDataSource.java:46)
	at org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource.(SQLServerDataSource.java:38)
	at org.jkiss.dbeaver.ext.mssql.SQLServerDataSourceProvider.openDataSource(SQLServerDataSourceProvider.java:123)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:768)
	at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70)
	at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:98)
	at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:106)
	at org.jkiss.dbeaver.registry.DataSourceDescriptor.initConnection(DataSourceDescriptor.java:663)
	at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:147)
	at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:195)
	at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1)
	at org.jkiss.dbeaver.ui.navigator.NavigatorUtils.getNodeChildrenFiltered(NavigatorUtils.java:564)
	at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49)
	at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1)
	at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:86)
	at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:71)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:95)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.sql.SQLException: Network error IOException: Socket closed
	at net.sourceforge.jtds.jdbc.JtdsConnection.(JtdsConnection.java:436)
	at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:148)
	at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:157)
	... 24 more
Caused by: java.net.SocketException: Socket closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:170)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at net.sourceforge.jtds.ssl.TdsTlsInputStream.readFully(TdsTlsInputStream.java:131)
	at net.sourceforge.jtds.ssl.TdsTlsInputStream.primeBuffer(TdsTlsInputStream.java:100)
	at net.sourceforge.jtds.ssl.TdsTlsInputStream.read(TdsTlsInputStream.java:78)
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
	at sun.security.ssl.InputRecord.read(InputRecord.java:503)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
	at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:101)
	at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:330)
	at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:577)
	at net.sourceforge.jtds.jdbc.JtdsConnection.(JtdsConnection.java:365)
	... 27 more

 

Explanation

  1. Here are the key details
    1. at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:101) at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:330) at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:577) at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:365)

Root Cause

The root cause is that we enabled “Force Encryption” on the database server; MS SQL Server in this case.

Database Platform

SQL Server Engine

SQL Server Configuration Manager ( SSCM )

Protocols

Force Encryption

Here we see that “Force Encryption” is turned on.

protocols.ForceEncryption.20181221.0823AM.PNG

 

SQL Server Engine – Error Log

Upon checking SQL Server Error Log, here are some nuggets :-

Image

errorLog.20181221.0920AM

Text

Message
Encryption is required to connect to this server but the client library does not support encryption; the connection has been closed. Please upgrade your client library. [CLIENT: 10.0.0.1]

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s