Вопрос

after a few hours of inactivity when am trying to access the DB with SQL adapter in Worklight. Getting the following error.however second time if am trying to connect the DB i can able to fetch the data's.

com.ibm.ws.rsadapter.jdbc.WSJdbcConnection W DSRA8650W: Error closing a JDBC child wrapper, com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement@39ba47f8 com.ibm.db2.jcc.am.SqlException: [jcc][10120][10943][4.13.127] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null A communication error occurred during operations on the connection's underlying socket, socket input stream, or socket output stream. Error location: T4Agent.sendRequest() - flush (-1). Message: Connection reset. ERRORCODE=-44

99, SQLSTATE=08001.

Currently i have set the maxConnectionPerNode as 1000 and requestTimeoutInSeconds is 60.

after a one day search came to know that for JEE apps, this issue comes when connection pool is having stale connections, or we are trying to access closed prepared statements. How to refresh the JDBC pool from Worklight? or How to make the connection alive?

Это было полезно?

Решение

I am assuming you are talking about your development environment.
The connection pool has timed out, therefore you are getting an error on the first invocation and a success on the second invocation. Once you will move to a production environment I assume you will not have hours of inactivity, and if you will you can configure the connection policy.

For example for WebSphere Application Server Liberty Profile configuration Edit the server.xml file and for every <dataSource> element add a <connectionManager> element with the agedTimeout property: <connectionManager agedTimeout="timeout"/>

For example:

<dataSource jndiName="jdbc/AppCenterDS" transactional="false"> 
  <connectionManager agedTimeout="7h30m"/>
  <jdbcDriver libraryRef="MySQLLib"/>
  ...
</dataSource>

See more information at: https://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/topic/com.ibm.worklight.installconfig.doc/install_config/c_handling_stale_mysql_connections.html

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top