resin的确是比较狠的应用服务器,运行速度快,配置又简单!这里介绍一下resin2.1.12的数据库连接池配置方法。
在%resinhome%/conf/resin.conf中找到
<!--
- sample database pool configuration
- the jdbc name is java:comp/env/jdbc/test
-->
在其下加入相应的信息可以连接到不同的数据库。
mysql:
<resource-ref>
<res-ref-name>jdbc/blog</res-ref-name>
<res-type>javax.sql.datasource</res-type>
<init-param driver-name="com.caucho.jdbc.mysql.driver"/>
<init-param url="jdbc:mysql_caucho://localhost:3306/blog"/>
<init-param user="root"/>
<init-param password="****"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30"/>
</resource-ref>
将相应的驱动放到%resin/lib/%下。
ms-sql:
<resource-ref>
<res-ref-name>jdbc/blog</res-ref-name>
<res-type>javax.sql.datasource</res-type>
<init-param driver-name="com.microsoft.jdbc.sqlserver.sqlserverdriver"/>
<init-param url="jdbc:microsoft:sqlserver://localhost:1433;databasename=blog"/>
<init-param user="sa"/>
<init-param password="****"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30"/>
</resource-ref>
首先要下载安装sqlserver-jdbc-驱动,然后将其lib下的三个jar文件放到%resin/lib/%下。
闽公网安备 35060202000074号