Page 1 of 1

Can't connect to H2 database of openkm from ouside of it

PostPosted:Tue Nov 12, 2019 7:22 am
by mamad
Hi guys
i installed openkm community edition with H2 database and now i want to connect to its H2 database from outside of it.
I installed H2 console and after opening console and entering information of server and database, it raised an exception and did not connect to the database.
This is a snapshot of login window :
( i installed H2 console on my local PC and openkm is running on a server with ip address of 192.168.1.50 )
Captureeee.PNG
Captureeee.PNG (26.89 KiB) Viewed 15182 times
And its the log made by the exception:
Code: Select all
Connection is broken: "java.net.ConnectException: Connection refused: connect: 192.168.1.50" [90067-200] 90067/90067 (Help)
org.h2.jdbc.JdbcSQLNonTransientConnectionException: Connection is broken: "java.net.ConnectException: Connection refused: connect: 192.168.1.50" [90067-200]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:622)
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
    at org.h2.message.DbException.get(DbException.java:194)
    at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:439)
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:321)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:173)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:152)
    at org.h2.Driver.connect(Driver.java:69)
    at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:309)
    at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:289)
    at org.h2.server.web.WebServer.getConnection(WebServer.java:785)
    at org.h2.server.web.WebApp.login(WebApp.java:1008)
    at org.h2.server.web.WebApp.process(WebApp.java:223)
    at org.h2.server.web.WebApp.processRequest(WebApp.java:173)
    at org.h2.server.web.WebThread.process(WebThread.java:139)
    at org.h2.server.web.WebThread.run(WebThread.java:94)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.h2.util.NetUtils.createSocket(NetUtils.java:103)
    at org.h2.util.NetUtils.createSocket(NetUtils.java:83)
    at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:119)
    at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:435)
    ... 13 more
Whats the problem ?
Thank you

Re: Can't connect to H2 database of openkm from ouside of it

PostPosted:Tue Nov 12, 2019 8:37 am
by mamad
I used this values for connecting to the database :

Driver Class : org.h2.Driver
JDBC URL : jdbc:h2:tcp://192.168.1.50/home/openkm/tomcat/repository/okmdb
User Name : sa
Password : sa

Are these values valid ?

Re: Can't connect to H2 database of openkm from ouside of it

PostPosted:Wed Nov 13, 2019 10:28 pm
by jllort
H2 database is an embedded database. This kind of database only allows a single connection, if you have OpenKM started then you can no get connection to the database. We do not suggest H2 for production, consider migration to MySQL, MariaDB, PostgreSQL, etc...

Re: Can't connect to H2 database of openkm from ouside of it

PostPosted:Thu Nov 14, 2019 8:22 am
by mamad
well,it seems like it's time to migrate to MySQL.
Thank you so much for your support

Re: Can't connect to H2 database of openkm from ouside of it

PostPosted:Fri Nov 15, 2019 6:58 pm
by jllort
There're some tools for migration, I think mysql workbench comes into with migration wizard. Another option is a fresh installation with mysql and use export and import OpenKM features.