oracle连接是的一个错误,帮忙看看
错误信息:Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
代码:
public class ConnOracle {
static private String strDriver = "oracle.jdbc.driver.OracleDriver";
static private String strUrl = "jdbc:oracle:thin:@192.168.2.200:1521:GIS_HN_Layered";
static private String strUser = "GIS_HN_Layered";
static private String strPwd = "GIS_HN_Layered";
private Connection conn = null;
private Statement stmt = null;
private ResultSet rs = null;
static {
try {
Class.forName(strDriver);
} catch (ClassNotFoundException ex) {
System.out.println("Error load " + strDriver);
}
}
public ConnOracle() {
}
public ResultSet executeQuery(String sql) {
try {
rs = getStatement().executeQuery(sql);
} catch (SQLException ex) {
System.err.println("query error:" + ex.getMessage());
}
return rs;
}
public boolean executeBatch(java.util.ArrayList sqls) {
boolean bRet = false;
try {
conn = getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
for (int i = 0; i < sqls.size(); i++) {
String sql = (String) sqls.get(i);
stmt.addBatch(sql);
}
stmt.executeBatch();
conn.commit();
bRet = true;
} catch (Exception ex) {
try {
conn.rollback();
} catch (Exception ex2) {
System.err.println("rollback failed:" + ex2.getMessage());
}
ex.printStackTrace();
} finally {
}
return bRet;
}
public void close() {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (stmt != null) {
stmt.close();
stmt = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (Exception ex) {
System.err.println("close error:" + ex.getMessage());
}
}
public Connection getConnection() {
try {
if (conn == null || conn.isClosed())
conn = DriverManager.getConnection(strUrl, strUser, strPwd);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return conn;
}
private Statement getStatement() {
try {
if (stmt == null)
stmt = getConnection().createStatement();
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return stmt;
}
public sta