Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. config 1:
  2. ◆tomcat#conf#server.xml
  3. <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxIdle="10" maxTotal="100" minEvictableIdleTimeMillis="10000"
  4. numTestsPerEvictionRun="10" removeAbandonedOnBorrow="true" removeAbandonedTimeout="10" type="javax.sql.DataSource" url="jdbc:mysql://dbserver:3306/***"
  5. username="***" password="***" name="jdbc/tomcatDataSource" validationQuery="SELECT NOW() FROM DUAL"/>
  6. ◆WEB-INF/web.xml
  7. <resource-ref>
  8. <description>tomcatDataSource</description>
  9. <res-ref-name>jdbc/tomcatDataSource</res-ref-name>
  10. <res-type>javax.sql.DataSource</res-type>
  11. <res-auth>Container</res-auth>
  12. <res-sharing-scope>Shareable</res-sharing-scope>
  13. </resource-ref>
  14. ◆spring config
  15. <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
  16. <property name="jndiName" value="java:comp/env/jdbc/tomcatDataSource" />
  17. </bean>
  18.  
  19. config 2:
  20. ◆spring config
  21. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  22. <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
  23. <property name="url"><value>jdbc:mysql://dbserver:3306/***</value></property>
  24. <property name="username"><value>***</value></property>
  25. <property name="password"><value>***</value></property>
  26. </bean>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement