public DBConnBean() throws Exception
    {

     conMgr =  DBConnectionManager.getInstance(); 
         
//==从配置文件中读取有关数据库的连接== //xml文件的路径(绝对路径)
   String fileName="config.xml";  
   String trace="";
  
   try{
   trace=getClass().getResource(fileName).toString();
   }catch(Exception ex){
   throw new AmbowException("FileNotExist",this.getClass().getName() + ".DBConnBean",fileName);
   }
  
   //去掉路径中的file:     
   trace=trace.substring(5);
   //String trace="C:\\Program Files\\Apache Tomcat 4.0\\webapps\\workroom\\WEB-INF\\classes\\cn\\com\\ambow\\system\\pr\\datasource\\config.xml";      
  //System.out.println(trace);
  //初始化读写的bean 
   XML.readXML readXmlBean  = new  XML.readXML();  
  //从xml文件中得到相关数据
   Document doc;
   Element root;

   try{
   readXmlBean.readXML(trace);
 
   doc=readXmlBean.getXmlDoc();     //得到根元素
   root = doc.getRootElement(); 
 
   }catch(java.lang.Exception ex){
   throw new AmbowException("XMLAnalyzeFailure",this.getClass().getName() + ".DBConnBean",trace);  
   }
      //得到根元素所有子元素的集合    
   java.util.List Configuration = root.getChildren();    
   Iterator it = Configuration.iterator(); 
     
    while (it.hasNext()) {
     Element e = (Element) it.next();
     DatabaseStatus=e.getChild("DatabaseStatus").getTextTrim();
     if (DatabaseStatus.equals("1")){
     name=e.getChild("PoolName").getTextTrim();
     Server=e.getChild("Server").getTextTrim();
     Port=e.getChild("Port").getTextTrim();   
     DatabaseName=e.getChild("DatabaseName").getTextTrim();
     url="jdbc:microsoft:sqlserver://"+Server+":"+Port+";DatabaseName="+DatabaseName;
     user=e.getChild("User").getTextTrim();
     password=e.getChild("Password").getTextTrim();
     maxconn=Integer.parseInt(e.getChild("Maxconn").getTextTrim());
     }
     //System.out.println(name);
     //System.out.println(url);
     //System.out.println(user);
     //System.out.println(password);
   }
         
  
//建立WebSite连接池
//name="WebSite";
//url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Develop";
//user="sa";
//password="";
//maxconn=20;

DBConnection dbc = new DBConnection(name,url,user,password,maxconn);
conMgr.newPool(dbc);   
    }