public static Connection getConnection() throws SQLException {
url = url.replace("${jdbc.ip}", jdbcIp);
return DriverManager.getConnection(url, user, password);
}
public static void free(ResultSet rs, Statement st, Connection conn) {
try {
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (st != null)
st.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (conn != null)
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
public static Boolean dealStationRestoreSid(String sId, String sIdBefore) throws Exception {
Connection conn = null;
CallableStatement statement = null;
Boolean flag = false;
String sql = "{call dealStationRestoreSid(?,?,?)}";
try {
conn = ConnUtils.getConnection();
statement = conn.prepareCall(sql);
statement.setString(1, sId);
statement.setString(2, sIdBefore);
statement.registerOutParameter(3,java.sql.Types.VARCHAR);
statement.executeUpdate();
if (statement.getString("dealStationRestoreSidFlag").equals("true")) {
flag = true;
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnUtils.free(null, statement, conn);
}
return flag;
}