【问题标题】:Error connecting to server localhost on port 1527 with message already in use在端口 1527 上连接到服务器 localhost 时出错,消息已在使用中
【发布时间】:2015-01-17 12:15:08
【问题描述】:

我在 Swing 应用程序中使用 derby 数据库。查询如下:

private String LEDGERGROUP(long Name){
String LG= "";
try{
String query = "SELECT LEDGER_GROUP FROM LEDGER_MASTER WHERE LEDGER_CODE = "+Name+" ";         
conn= con.db();
stmtt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmtt.executeQuery(query);
if(rs.next()){
LG = rs.getString("LEDGER_GROUP")  ;
}}
catch (SQLException ex ) {
//JOptionPane.showMessageDialog(null, "Unknown Error!!"+ex);
System.out.println("Unknown Error!!"+ex);
} finally{try{if(stmtt!=null){stmtt.close();} if(conn!=null){conn.close();} if(rs!=null){rs.close();}}catch(SQLException ex){}}

return LG;

}

我正在调用此消息以使用循环更新 jtable。

for(int i = 0; i<jTable1.getRowCount(); i++){
String code = jTable1.getValueAt(i, 0).toString();
Long l = Long.parseLong(code);
String lc = LEDGERGROUP(l);
jTable1.setValueAt(lc, i, 2);
}

循环运行了一段时间。但突然我收到错误消息。 Error connecting to server localhost on port 1527 with message already in use. 为什么会有这条消息?如何摆脱此消息并继续循环。

【问题讨论】:

    标签: java swing loops derby


    【解决方案1】:
    Error connecting to server localhost on port 1527 with message already in use.
    

    当任何其他进程使用您的端口 1527 检查哪个进程使用该端口并终止该进程时,就会出现异常。

    【讨论】:

    • 如何通过我的 java 程序做到这一点?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-08
    • 1970-01-01
    • 2022-01-26
    • 2021-12-24
    相关资源
    最近更新 更多