Here JdbcSQLNonTransientConnectionException exception occurred because trying to connect H2 database through application while it’s already connected through eclipse data source explorer. That’s why when running application will through exception as “Database may be already in use :null“.
JdbcSQLnonTransientConnectionException Stacktrace
org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:617) ~[h2-1.4.199.jar:1.4.199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
at org.h2.message.DbException.get(DbException.java:194) ~[h2-1.4.199.jar:1.4.199]
at org.h2.mvstore.db.MVTableEngine$Store.convertIllegalStateException(MVTableEngine.java:193) ~[h2-1.4.199.jar:1.4.199]
at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:173) ~[h2-1.4.199.jar:1.4.199]
at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:95) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Database.getPageStore(Database.java:2739) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Database.open(Database.java:769) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Database.openDatabase(Database.java:319) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Database.(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]
Solutions
Follow below steps to resolve this issue. You just need to follow disconnect steps. Connect steps are just to reference to reach Data source explorer.
Steps to connect with H2 database with Eclipse
- Go to eclipse
- Go to tab Window -> View -> Type “Data” – Click on “Data Explorer”.
- Select “Generic JDBC”
- Fill properties as below.
- Then click on Finish.
Steps to disconnect database through eclipse
- Go to “Data Explore”.
- Expend Database connection.
- Right click on H2DB database
- Select option Disconnect.
Now run application your issue get resolved.
You would like to see
Follow below link to see more JDBC, Hibernate and JPA issues solutions.
You must be logged in to post a comment.