Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Context
- <?xml version = "1.0" encoding = "UTF-8"?>
- <Context>
- <Resource name="jdbc/shop_MYSQL"
- global="jdbc/shop_MYSQL"
- auth="Container"
- type="javax.sql.DataSource"
- maxActive="100" maxIdle="30" maxWait="10000"
- username="root"
- driverClassName="com.mysql.jdbc.Driver"
- defaultAutoCommit="false"
- defaultTransactionIsolation="READ_COMMITTED"
- url="jdbc:mysql://localhost:3306/shop"/>
- </Context>
- web.xml
- </context-param>
- <resource-ref>
- <res-ref-name>jdbc/shop_MYSQL</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- </resource-ref>
- Pom
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>8.0.11</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jdbc</artifactId>
- <version>8.0.20</version>
- </dependency>
- code:
- Context ctx = new InitialContext();
- ds = (DataSource) ctx.lookup("java:comp/env/jdbc/shop_MYSQL");
- Connection conn = ds.getConnection();
- 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