SQLException “The account is locked” occurs due to password policy set for user account. If user trying to connect database with wrong password so many times will lock your database account.
Error Code ORA-28000 is for Oracle Database for account lock.
Sample Code
try { Class.forName("oracle.jdbc.driver.OracleDriver"); connection=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "admin", "saurabh"); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (SQLException ex) { ex.printStackTrace(); }
Output Message
java.sql.SQLException: ORA-28000: the account is locked
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:388)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:381)
at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:564)
at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359)
at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Issue
Here Database user account is lock due to try login database with wrong password.
There can be some other reasons also like as your DBA assigned particular IP for user and same user trying to use another machine to access database then also database account can also be locked.
Solutions
To unlock database account run follow below steps:
To unlock your Local database password
- Execute Query
alter user <your_username> account
- Check the PASSWORD_LOCK_TIME parameter. if it is set to 1 then you won’t to be able to unlock the password for 1 day even after you executed above query.
To unlock Remote Database handle by DBA:
- Reach to you database DBA to unlock your database account because he only know what password policy implemented.
More Issues Solution
For more other JAVA/JDBC issues solution follow link JDBC Issues and Solutions.
You must log in to post a comment.