user4545129
user4545129

Reputation: 1

Unable to access H2 Database in LAN

Please go through below code that I wrote in Java Swing to connect H2 Database in LAN, I did Google but not get proper solution.

try {
        //192.168.0.200 is Partner IP Address
        Class.forName("org.h2.Driver");
        Connection connection = DriverManager.getConnection("jdbc:h2:tcp://192.168.0.200/~/testingDB", "sa", "");
        System.out.println("Connected" + connection);
    } catch (Exception e) {
        System.out.println("Here" + e.toString());
    }

I am trying to connect H2 Database that are installed on another computer using IPV4 address but I am getting below error.

Hereorg.h2.jdbc.JdbcSQLException: Remote connections to this server are not allowed, see -tcpAllowOthers [90117-184]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:83)
at java.lang.Thread.run(Unknown Source)

I given below command in partner as well as my computer but still I am getting the same error.

http://www.windows-commandline.com/enable-remote-desktop-command-line/

Please help me to find the solution.

Upvotes: 0

Views: 727

Answers (1)

Thomas Mueller
Thomas Mueller

Reputation: 50147

You need to start the H2 server with the -tcpAllowOthers option. This option is not enabled by default for security reasons.

Upvotes: 1

Related Questions