I deployed the application on the tomcat server, immediately after that, the connection is established successfully, but after about 1 hour I cannot connect to the database.

Connection pooling using c3p0, Oracle 12.0.1, in the apache-tomcat / lib folder is ojdbc7.jar

C3p0 settings:

<?xml version="1.0" encoding="utf-8" standalone="no"?> <Context> <Resource name="jdbc/REP" auth="Container" type="com.mchange.v2.c3p0.ComboPooledDataSource" user="*****" password="******" driverClass="oracle.jdbc.driver.OracleDriver" jdbcUrl="jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=off)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=rep-db01.***.ru)(PORT=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=rep-db02.****.ru)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=service_rep)))" factory="org.apache.naming.factory.BeanFactory" minPoolSize="15" maxPoolSize="100" acquireIncrement="10" testConnectionOnCheckin="true" testConnectionOnCheckout="true" idleConnectionTestPeriod="30" preferredTestQuery="select 1 from dual" maxIdleTimeExcessConnections="240" unreturnedConnectionTimeout="10000" debugUnreturnedConnectionStackTraces="true" acquireRetryAttempts="0" initialPoolSize="20" dataSourceName="java:/comp/env/jdbc/REP" /> </Context> 

In the logs I see the following:

 2017-07-12 11:25:23,217 DEBUG [] An exception occurred while acquiring a poolable resource. Will retry. java.sql.SQLRecoverableException: ORA-01033: ORACLE initialization or shutdown in progress at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:385) at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:497) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257) at oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:460) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:594) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:183) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:172) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:188) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1074) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1061) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1798) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 

 2017-07-12 11:25:23,249 DEBUG [] Continuing acquisition series. pending_acquires [20], attempts_remaining: 9 2017-07-12 11:25:23,249 DEBUG [] com.mchange.v2.async.ThreadPoolAsynchronousRunner@3b3f4e1e: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@769e5eb6 2017-07-12 11:25:23,370 DEBUG [] Continuing acquisition series. pending_acquires [20], attempts_remaining: 9 2017-07-12 11:25:23,370 DEBUG [] com.mchange.v2.async.ThreadPoolAsynchronousRunner@3b3f4e1e: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@175c3b91 2017-07-12 11:25:23,373 DEBUG [] An exception occurred while acquiring a poolable resource. Will retry. java.sql.SQLRecoverableException: ORA-01033: ORACLE initialization or shutdown in progress at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:385) at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:497) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257) at oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:460) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:594) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:183) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:172) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:188) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1074) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1061) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1798) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) 
  • 2
    In general, such an error does not depend on the application, something happens to the oracle server itself, some of its components may have crashed. And most likely at such a moment the connection is no longer possible from anywhere. - Mike
  • Why then, after several attempts to establish a connection, is the connection established? After about 5 attempts. - denisT
  • one
    Probably server orakla at this moment just restarted and here after some time he finally started and started to let clients. In general, to begin with, eliminate the possibility that something was with the server itself, look at alert.log on it. - Mike
  • Thank you, Mike. I will watch - denisT

0