Search code examples
jdbcconnection-poolingibm-midrangepool

AS400 jdbc connection pool problem


I'm using AS400JDBCConnectionPoolDataSource and AS400JDBCConnectionPool in order to create a connection pool inside my project.

this is my code for creating it:

         AS400JDBCConnectionPoolDataSource dataSource = new AS400JDBCConnectionPoolDataSource();

        dataSource.setServerName(DEVELOP);
        dataSource.setUser(USER);
        dataSource.setPassword(PASSWORD);
        dataSource.setDriver(DRIVER);
        dataSource.setPassword(PASSWORD);
        dataSource.setLibraries("*LIBL");
        dataSource.setNaming(NAME);

        AS400JDBCConnectionPool systemi_jdbc_pool = new AS400JDBCConnectionPool(dataSource);
        systemi_jdbc_pool.setMaxLifetime(-1);
        systemi_jdbc_pool.setMaxConnections(4);
        systemi_jdbc_pool.fill(2);

My problem is that the connection is closed every 2-2.5 hours.. and I can't understand why , the max life time is set to -1 which means taht there is no limit on the time.

What could be the problem? how can I make the connection pool not to disconnect itseld?

Thank's In Advance.


Solution

  • found a solution: Database Host Server Connections Drop after a Period of Inactivity