package market.Cm.impl;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CmPbMethod {
	
	public Connection getConnection(){
		Connection con = null;
		String Url="jdbc:oracle:thin:@172.16.0.76:1521:sale";
        String User="SSO";
        String Password="sso";
        try {
        	//1.加载驱动程序
			Class.forName("oracle.jdbc.driver.OracleDriver");
			//2.获得数据库链接
	        con=DriverManager.getConnection(Url,User,Password);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
        return con;
	}
	
	public void doClose(ResultSet rs,PreparedStatement ps,Connection con){
		try {
			if (rs!=null)   rs.close();
			if (ps!=null)   ps.close();
			if (con!=null)  con.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}		
	}
	
}
