请仔细阅读下面我在Java Swing中编写的代码来连接局域网中的H2数据库,但是我做了Google,但没有得到正确的解决方案。无法访问局域网中的H2数据库
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());
}
我想连接H2使用IPV4地址在另一台计算机上安装的数据库,但出现以下错误。
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)
我在合作伙伴以及我的电脑给出了下面的命令,但仍然收到了同样的错误。
http://www.windows-commandline.com/enable-remote-desktop-command-line/
请帮我找到解决方案。
H2是否在服务器模式下运行? – MadProgrammer 2015-02-09 06:53:44
你的意思是说在Generic H2(服务器)上。我在浏览器上试过,它运行完美,但没有通过给定的Java代码。 – user4545129 2015-02-09 07:00:20
H2服务器不在TCP模式下 – MadProgrammer 2015-02-09 07:01:26