proxool.properties 文件配置
jdbc-0.proxool.alias=oracle
jdbc-0.proxool.driver-class=oracle.jdbc.driver.OracleDriver
jdbc-0.proxool.driver-url=jdbc:oracle:thin:@192.168.2.150:1521:test
jdbc-0.user=scott
jdbc-0.password=tiger
jdbc-0.proxool.maximum-connection-count=100
jdbc-0.proxool.house-keeping-sleep-time=1
jdbc-0.proxool.prototype-count=20
jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
jdbc-0.proxool.verbose=true
jdbc-0.proxool.statistics=10s,1m,1d
jdbc-0.proxool.statistics-log-level=ERROR
DBUtil类:
static
{
InputStream is = DBUtil.class.getResourceAsStream("/proxool.properties");
Properties pro=new Properties();
try {
pro.load(is);
PropertyConfigurator.configure(pro);
} catch (Exception e1) {
e1.printStackTrace();
}
}
private static DBUtildb=new DBUtil();
public static DBUtil getInstance()
{
return db;
}
private Connection LoadConnection()
{
Connection con=null;
try {
con = DriverManager.getConnection("proxool.oracle");
} catch (SQLException e) {
e.printStackTrace();
}
return con;
}
private void CloseRS(ResultSet rs)
{
try {
if(rs!=null)
{
rs.close();
rs=null;
}
} catch (SQLException e) {
System.out.println("关闭resultSet出错");
e.printStackTrace();
}
}
private void CloseCon(Connection con)
{
try {
if(con!=null && !con.isClosed())
{
con.close();
con=null;
}
} catch (SQLException e) {
System.out.println("关闭Connection出错");
e.printStackTrace();
}
}
private void CloseStatement(Statement st)
{
try {
if(st!=null)
{
st.close();
st=null;
}
} catch (SQLException e) {
System.out.println("关闭Statement出错");
e.printStackTrace();
}
}
jdbc-0.proxool.alias=oracle
jdbc-0.proxool.driver-class=oracle.jdbc.driver.OracleDriver
jdbc-0.proxool.driver-url=jdbc:oracle:thin:@192.168.2.150:1521:test
jdbc-0.user=scott
jdbc-0.password=tiger
jdbc-0.proxool.maximum-connection-count=100
jdbc-0.proxool.house-keeping-sleep-time=1
jdbc-0.proxool.prototype-count=20
jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
jdbc-0.proxool.verbose=true
jdbc-0.proxool.statistics=10s,1m,1d
jdbc-0.proxool.statistics-log-level=ERROR
DBUtil类:
static
{
InputStream is = DBUtil.class.getResourceAsStream("/proxool.properties");
Properties pro=new Properties();
try {
pro.load(is);
PropertyConfigurator.configure(pro);
} catch (Exception e1) {
e1.printStackTrace();
}
}
private static DBUtildb=new DBUtil();
public static DBUtil getInstance()
{
return db;
}
private Connection LoadConnection()
{
Connection con=null;
try {
con = DriverManager.getConnection("proxool.oracle");
} catch (SQLException e) {
e.printStackTrace();
}
return con;
}
private void CloseRS(ResultSet rs)
{
try {
if(rs!=null)
{
rs.close();
rs=null;
}
} catch (SQLException e) {
System.out.println("关闭resultSet出错");
e.printStackTrace();
}
}
private void CloseCon(Connection con)
{
try {
if(con!=null && !con.isClosed())
{
con.close();
con=null;
}
} catch (SQLException e) {
System.out.println("关闭Connection出错");
e.printStackTrace();
}
}
private void CloseStatement(Statement st)
{
try {
if(st!=null)
{
st.close();
st=null;
}
} catch (SQLException e) {
System.out.println("关闭Statement出错");
e.printStackTrace();
}
}