Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config 1:
- ◆tomcat#conf#server.xml
- <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxIdle="10" maxTotal="100" minEvictableIdleTimeMillis="10000"
- numTestsPerEvictionRun="10" removeAbandonedOnBorrow="true" removeAbandonedTimeout="10" type="javax.sql.DataSource" url="jdbc:mysql://dbserver:3306/***"
- username="***" password="***" name="jdbc/tomcatDataSource" validationQuery="SELECT NOW() FROM DUAL"/>
- ◆WEB-INF/web.xml
- <resource-ref>
- <description>tomcatDataSource</description>
- <res-ref-name>jdbc/tomcatDataSource</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
- ◆spring config
- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName" value="java:comp/env/jdbc/tomcatDataSource" />
- </bean>
- config 2:
- ◆spring config
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
- <property name="url"><value>jdbc:mysql://dbserver:3306/***</value></property>
- <property name="username"><value>***</value></property>
- <property name="password"><value>***</value></property>
- </bean>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement