Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Com {
- public static Connection getConnection(){
- Connection conn = null;
- try{
- Class.forName("oracle.jdbc.driver.OracleDriver");
- conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522:orcl", "SH12", "121212");
- }catch (Exception e) {
- e.printStackTrace();
- }
- return conn;
- }
- public static void closeConnection(Connection conn){
- try{
- if(conn != null){
- if(!conn.isClosed()){
- conn.close();
- }
- }
- }catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement