0

I have been trying to configure hibernate with my restful service for making API calls to DB. I have configured hibernate connection properties as follows.

    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@ABCDHostname:12345:ABCDHost</property>
    <property name="hibernate.connection.driver_class">amazon.jdbc.driver.SecureDriver</property>
    <property name="hibernate.c3p0.min_size">2</property>
    <property name="hibernate.c3p0.max_size">5</property>
    <property name="hibernate.c3p0.acquireIncrement">2</property>
    <property name="hibernate.c3p0.initialPoolSize">2</property>
    <property name="hibernate.c3p0.timeout">36000</property>
    <property name="hibernate.c3p0.idle_test_period">300</property>
    <property name="hibernate.c3p0.preferredTestQuery">select 1 from dual</property>
    <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

    <!-- Set the context of a session to enable the use of getCurrentSession() -->
    <property name="hibernate.current_session_context_class">thread</property>

</session-factory>

I get the DB username and password from my java program which is correct and verified.

The issue is when I run this program the account gets locked immediately at the DB level not sure what is causing this issue.

Error Logs states as follows:- [java] 16 Nov 2018 00:19:25,920 [WARN] [] (C3P0PooledConnectionPoolManager[identityToken->2shhjy9z76iitk1d7keqo|15be40d5]-HelperThread-#0) com.mchange.v2.resourcepool.BasicResourcePool: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@f525c9d -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: [java] java.sql.SQLException: ORA-28000: the account is locked

[java] 16 Nov 2018 00:19:25,924 [WARN] [] (http-nio-0.0.0.0-8001-exec-12) org.hibernate.util.JDBCExceptionReporter: SQL Error: 0, SQLState: null [java] 16 Nov 2018 00:19:25,925 [ERROR] [] (http-nio-0.0.0.0-8001-exec-12) org.hibernate.util.JDBCExceptionReporter: Connections could not be acquired from the underlying database! [java] 16 Nov 2018 00:19:25,925 [ERROR] [] (http-nio-0.0.0.0-8001-exec-12) com.amazon.mytimeutilities.utils.mytime.PeoplePortalStagingCaller: org.hibernate.exception.GenericJDBCException: Cannot open connection [java] 16 Nov 2018 00:19:25,932 [ERROR] [] (http-nio-0.0.0.0-8001-exec-12) org.apache.catalina.core.ContainerBase.[Tomcat]. [java] org.jboss.resteasy.spi.UnhandledException: org.hibernate.exception.GenericJDBCException: Cannot open connection.

Any pointers on what might be the issue in here.

Thanks.

Srikanth
  • 1
  • 5

1 Answers1

0

Some process is trying to log in to that account using an incorrect password. The guess guess would be that the account is being locked because it's exceeding the number of allowed incorrect logins.

You can unlock the account like below.

ALTER USER USER_NAME ACCOUNT UNLOCK;

Refer ora-28000-the-account-is-locked

Alien
  • 15,141
  • 6
  • 37
  • 57