public class ConnectionUtil {
/**
* 对数据库进行连接
* @author FanChengLong
* @return Connection连接对象
*/
public static Connection getConnection() {
String url = "jdbc:oracle:thin:@10.6.109.52:1521:or10g";
String userName = "ytbdatadr2";
String password = "ytbdatadr2";
Connection con = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection(url, userName, password);
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
public static void closeCon(Connection con) throws SQLException {
con.close();
}
public static void closeSt(Statement st) throws SQLException {
st.close();
}
public static void closeRs(ResultSet rs) throws SQLException {
rs.close();
}
}