H2 jdbc Connection refused: connect 90067-147

2019-05-30 22:56发布

I got a project to upgrade and it is using h2 DB with jdbc driver. During the build I have a systematic error on connection:

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Connection is broken: "Connection refused: connect" [90067-147]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:380)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:271)
at org.h2.engine.SessionRemote.createSession(SessionRemote.java:265)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

I don't see why the connection is refused, the server is well started on the same URL, PORT and DB as the one requested.

The server is well started, but the error happen when I want to open the connection:

Connection connection = DriverManager.getConnection(DBURL, DBUSER, DBPWD + " " + DB_PWD);

Any idea about what can be the cause?

Update: This problem was not related to the firewalls but mainly to the server DB path.

0条回答
登录 后发表回答