在Tomcat 中配置PostgreSQL 連接池


 設置tomcat連接池了,先把tomcat目錄下的  /tomcat/conf/server.xml 打開,
  找到<Context>標籤,在它下層加入下面代碼

  <Resource name="jdbc/test"
               url="jdbc:postgresql://localhost:5432/testdb"
               username="happy"
               password="world"              
               auth="Container"
               type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
              
 driverClassName="org.postgresql.Driver" />
然後還有個問題就是要在你工程的發佈配置文件web.xml註冊  :
在<webapps>標籤裏  加入
  <description>postgresql conn pool</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/test</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章