Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. Context
  2. <?xml version = "1.0" encoding = "UTF-8"?>
  3. <Context>
  4. <Resource name="jdbc/shop_MYSQL"
  5. global="jdbc/shop_MYSQL"
  6. auth="Container"
  7. type="javax.sql.DataSource"
  8. maxActive="100" maxIdle="30" maxWait="10000"
  9. username="root"
  10. driverClassName="com.mysql.jdbc.Driver"
  11. defaultAutoCommit="false"
  12. defaultTransactionIsolation="READ_COMMITTED"
  13. url="jdbc:mysql://localhost:3306/shop"/>
  14. </Context>
  15.  
  16. web.xml
  17. </context-param>
  18. <resource-ref>
  19. <res-ref-name>jdbc/shop_MYSQL</res-ref-name>
  20. <res-type>javax.sql.DataSource</res-type>
  21. <res-auth>Container</res-auth>
  22. </resource-ref>
  23.  
  24. Pom
  25. <dependency>
  26. <groupId>mysql</groupId>
  27. <artifactId>mysql-connector-java</artifactId>
  28. <version>8.0.11</version>
  29. </dependency>
  30. <dependency>
  31. <groupId>org.apache.tomcat</groupId>
  32. <artifactId>tomcat-jdbc</artifactId>
  33. <version>8.0.20</version>
  34. </dependency>
  35.  
  36. code:
  37. Context ctx = new InitialContext();
  38. ds = (DataSource) ctx.lookup("java:comp/env/jdbc/shop_MYSQL");
  39. Connection conn = ds.getConnection();
  40.  
  41. org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement