1. 安裝postgresql資料庫
1.1 執行安裝包裡面setup.bat開始安裝
1.2 第一個使用者是postgresql資料庫專用的作業系統使用者,第二個資料庫使用者
1.3 其他選項採用預設值即可
2. 安裝pgAdminII,postgresql專用的用戶端
2.1 初始化資料庫(注意把指令碼中的使用者替換為你的真是使用者)
3. 安裝JDK(1.5.0)或JRE(1.5.0)
4. 拷貝apache-tomcat-5.5.xx到合適的目錄
5. 配置tomcat
5.1 JNDI配置
server.xml 中添加一下元素(red),注意要根據自己的項目修改以下屬性值
<GlobalNamingResources>
... ...
<Resource
name="jdbc/newbee"
type="javax.sql.DataSource"
password="esoon"
driverClassName="org.postgresql.Driver"
maxIdle="2"
maxWait="5000"
validationQuery="select 1"
username="sa"
url="jdbc:postgresql://localhost:5432/newbee"
maxActive="4"/>
</GlobalNamingResources>
手工添加檔案 conf/Catalina/localhost/newbee.xml ,檔案名稱與應用項目要一致, 內容如下:
<Context docBase="C:/apache-tomcat-5.5.17/webapps/newbee" privileged="true">
<ResourceLink name="jdbc/newbee" global="jdbc/newbee" type="javax.sql.DataSource"/>
</Context>
把資料庫驅動拷貝到 %Tomcat_home%/common/lib 目錄下
6. 把log4j.properties檔案中的絕對路徑修改為合適的值