当我使用以下代码连接sybase ASE 16时,出现错误:
JZ006:Caught IOException:java.net.ConnectException:Connection 拒绝
代码是:
package sybase;
import java.sql.*;
import java.util.*;
public class Conn2ASE {
public static void main(String[] args) {
try {
Class.forName("com.sybase.jdbc3.jdbc.SybDriver").newInstance();
String url = "jdbc:sybase:Tds:192.168.100.120:5000/master";
Properties sysProps = System.getProperties();
sysProps.put("user", "sa");
sysProps.put("password", "560128");
Connection conn = DriverManager.getConnection(url, sysProps);
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql = "select id,name,crdate from dbo.sysobjects where type='U'";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println("oject_id:"+rs.getString(1)+",oject_name:"+rs.getString(2));
}
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
有什么问题?有谁能告诉我?