Most reconnection issues with the MSSQL Database are caused by too many TCP connections to the database. The SQL server has no free ports during the connection setup phase. The error looks like
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.
The follow changes can reduce the number of failed connection setups for the application code:
Since version 9.4.0 the JDBC driver contains an additional parameter for reconnect.
The mssql-jdbc driver is updated in all LTS versions of ICM. To improve the rollout speed of the change, the project can apply a version filter to update the library without updating the whole project. Please keep in mind to remove the "patch" after migrating to the latest LTS version.
Library | Old Version | New Version |
---|---|---|
com.microsoft.sqlserver:mssql-jdbc | 8.4.1.jre8 | 9.4.0.jre8 |
Following adaptions are recommended:
Property | Default | Value |
---|---|---|
connectRetryCount | 1 | 3 |
connectRetryInterval | 10 | 20 |
loginTimeout | 15 | 30 |
See the documentation of the jdbc-driver to configure the reconnect capability.
All libraries are listed at <IS_SHARE>/ivy.xml. The line can be found easily.
cat ivy.xml | grep "mssql-jdbc"
<dependency org="com.microsoft.sqlserver" name="mssql-jdbc" rev="9.4.0.jre8" conf="development-cartridges, production-cartridges, test-cartridges" transitive="false"/>
ICM | mssql-jdbc |
---|---|
7.10.26.19-LTS | 9.4.0.jre8 |
7.10.32.9-LTS | 9.4.0.jre8 |
7.10.37.0 | 9.4.0.jre8 |
7.10.38.3-LTS | 9.4.0.jre8 |
In case the project can't update to an newer ICM soon. The version can be defined at project too. The project can declare a specific filter for project-specific dependencies, please add this section to the build.gradle of the customization. The build.gradle can contain the following block:
versionRecommendation { provider { // thirdparty.version to resolve version conflicts of custom cartridges properties('thirdparty', file('thirdparty.version')) {} } }
Afterwards versions can be adapted in the Java-like property file:
com.microsoft.sqlserver:mssql-jdbc=9.4.1.jre8
The documented version of the JDBC driver could be updated meanwhile. See https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc. Keep in mind that the version needs to have a JRE8 extension.
ICM uses an Apache connection pool which has 3 important configurations:
Property | Description | old | new | for larger installations |
---|---|---|---|---|
intershop.jdbc.mssql.dbcp.pool.MaxIdle | In case the pool has more than this amount of idle connections, the pool will automatically close connections, which are "closed" by the application. | 5 | 16 | 45 |
intershop.jdbc.mssql.dbcp.pool.MinIdle | In case the pool has less than this amount of idle connections, the pool will automatically create new connections without an explicit connection request | 5 | 4 | 15 |
intershop.jdbc.mssql.dbcp.pool.MaxTotal | Max amount of connections handle by the pool | 150 | 150 | 150 |
The value of MaxIdle should be significant larger than MinIdle, so that used connections can be stored in the pool without closing them. The MinIdle value can be increased in case the application needs very fast a larger amount of connections.
Transient Lock
During the staging process, the TransientLock is set for locking resources. These connection between ICM and the SQLServer can be closed by infrastructure components like network or by the SQL Server it self, in case these connections are not used for a long time. To avoid such situations the "TransientLock" can be configured with an heartbeat.
Property | Description | old | new |
---|---|---|---|
intershop.jdbc.connection.Heartbeat.Interval | enables and declare period between two heartbeats in seconds | 0 | 30 |
Version | Description |
---|---|
7.10.38.14-LTS | Changes the default of intershop.jdbc.connection.Heartbeat.Interval for TransientLock to 30 |