Tomcat connection pooling with prepared statement cache

百般思念 提交于 2019-12-03 20:14:35

Tomcat's (fairly) new jdbc-pool does have a statement cache, too. You can enable and configure it using a JDBC interceptor, which is set as a JDBC property during pool creation.
Please have a look at the documentation for more information and which configuration possibilities exist.

It's basically done this way:

      PoolProperties p = new PoolProperties();
      p.setUrl("jdbc:your-jdbc-url");
      p.setDriverClassName("your.jdbc.driver.class");
      p.setUsername("user");
      p.setPassword("password");
      p.setJdbcInterceptors(
        "org.apache.tomcat.jdbc.pool.interceptor.StatementCache");
      DataSource datasource = new DataSource();
      datasource.setPoolProperties(p);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!