小编Nad*_*aad的帖子

使用Java应用程序远程连接到H2数据库

我遇到以下问题:当我尝试使用我的外部IP地址(PC的IP而不是我的本地IP =我们在cmd.exe中运行ipconfig后看到的输出)创建TCP服务器时,会发生以下错误:

服务器出错:异常打开端口"9092"(端口可能正在使用中),原因:"java.net.BindException:无法分配请求的地址:JVM_Bind"[90061-169]

但是,端口未使用.我已经使用netstat -a -n检查过了.我启用了外部IP,并且已从路由器禁用了防火墙.我的外部IP现在可以被ping.

请帮我.

更新:这是启动tcp服务器的代码.

package businessApp;

import org.h2.tools.Server; //imports the server utility

public class startTcpServerForH2 {

    Server server; //the server's instance variable

    private static final String SERVER_IP = "192.168.1.101"; //fixed IP of the server
    private static final String SERVER_PORT = "9092"; //fixed port the server is listening to

    public void tcpServer() { //method responsible to create the tcp server

        optionPane optPane = new optionPane(); //option pane for debugging purposes, shows the server's status

        try { //catches …
Run Code Online (Sandbox Code Playgroud)

java h2

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

h2 ×1

java ×1