postgreSQL连接池

import javax.servlet.ServletConfig;  
import javax.servlet.ServletException;  
import javax.servlet.http.HttpServlet;  
import org.postgresql.ds.PGPoolingDataSource;  
import com.sun.xml.internal.bind.CycleRecoverable.Context;  
public class postchi extends HttpServlet {  
    public static PGPoolingDataSource pgpool = null;  
    public void destroy() {  
        super.destroy();   
    }  
    public void init() throws ServletException {  
        if(pgpool == null){  
            String DataSourceName=this.getInitParameter("DataSourceName");  
            String ServerName=this.getInitParameter("serverName");  
            String User=this.getInitParameter("User");  
            String Password=this.getInitParameter("password");  
            int MaxConnections=Integer.parseInt(this.getInitParameter("MaxConnections"));  
            String dbInstance=this.getInitParameter("dbInstance");  
          /*  System.out.println(User);  
            System.out.println(Password);*/  
            pgpool = new PGPoolingDataSource();  
            pgpool.setDataSourceName(DataSourceName);   
            pgpool.setServerName(ServerName);   
            pgpool.setDatabaseName(dbInstance);   
            pgpool.setUser(User);   
            pgpool.setPassword(Password);   
            pgpool.setMaxConnections(MaxConnections);  
        }  
    }  

你可能感兴趣的:(xml,servlet,PostgreSQL,sun)