javaee and spring24 六 2010 05:28 下午

1)将mysql数据库jdbc驱动mysql-connector-java-5.1.7-bin.jar放置于D:\resin-3.1.9\ext-lib目录下

2)D:\resin-3.1.9\conf\resin.conf增加

<database>

<jndi-name>jdbc/mysql</jndi-name>

<driver type=”com.mysql.jdbc.Driver”>

<url>jdbc:mysql://localhost:3306/fare?user=root&amp;password=root&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8</url>

<user>root</user>

<password>root</password>

</driver>

<prepared-statement-cache-size>8</prepared-statement-cache-size>

<max-connections>20</max-connections>

<max-idle-time>30s</max-idle-time>

</database>

3)spring中通过jndi获取数据源

<bean id=”dataSource”>

<property name=”jndiName”><value>java:comp/env/jdbc/mysql</value></property>

</bean>

Comments are closed.