Quantcast
Viewing all articles
Browse latest Browse all 4532

JNDI Connection Pool does not re-connect after MS SQL Server 2014 restart or post the availbility group server fail over

Our JNDI connection pool on tomcat (8.0) does not reconnect after MS SQL Server( 2014) restarts. unless, I restart the tomcat , the DB connection pool remains in state of closed connection , even though the SQL server is up. But if I provide DB URL details instead of JNDI, the connection pool restores the connection post a restart of SQL Server, and does not demand and restart of the tomcat.

This happens also when SQL Server failovers in availability cluster , though the secondary becomes active in DB availability cluster.

Please let me know if any property needs to be additionally defined for this work.

Tried with autoReconnect=true, but that doesn't work. Please do help on the what is auto reconnect property to set to JNDI configuration 

The JNDI config is 

auth="Container"
type="javax.sql.DataSource"
initialSize="10"
maxActive="100"
maxIdle="10"
minIdle="0"
maxWait="1000000"
timeBetweenEvictionRunsMillis="1000"
minEvictableIdleTimeMillis="1000"
validationQuery="SELECT 1"
validationInterval="1000"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
removeAbandoned="true"
removeAbandonedTimeout="3000"
logAbandoned="true"
username="XX"
password="XX"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustServerCertificate=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;packetSize=8000;multiSubnetFailover=true;loginTimeout=10;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=XX;applicationName=Microsoft JDBC Driver for SQL Server;applicationIntent=readwrite;autoReconnect=true;"/>

Below is stack trace :

[SQLErrorCodesFactory] Error while extracting database product name - falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.microsoft.sqlserver.jdbc.SQLServ
erException: The connection is closed.
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:305)
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:329)
at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:214)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:134)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.(SQLErrorCodeSQLExceptionTranslator.java:97)
at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:99)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:727)

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:388)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getMetaData(SQLServerConnection.java:2026)
at sun.reflect.GeneratedMethodAccessor214.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)
at com.sun.proxy.$Proxy4.getMetaData(Unknown Source)

Thanks,

Nivedita


Viewing all articles
Browse latest Browse all 4532

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>