带有tomcat jdbc连接池的Jetty

带有tomcat jdbc连接池的Jetty,jetty,tomcat-jdbc,Jetty,Tomcat Jdbc,Jetty手册提供了连接池示例,包括BoneCP、c3p0、DBCP,但不包括tomcat jdbc。 可以用tomcat jdbc连接池配置Jetty吗 我一直在jetty 9.3和tomcat jdbc 7.0.72中使用这种配置 <!-- =========================================================== --> <!-- DataSource

Jetty手册提供了连接池示例,包括BoneCP、c3p0、DBCP,但不包括tomcat jdbc。
可以用tomcat jdbc连接池配置Jetty吗

我一直在jetty 9.3和tomcat jdbc 7.0.72中使用这种配置

  <!-- =========================================================== -->
  <!-- DataSource                                                  -->
  <!-- =========================================================== -->

  <New id="rfid" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jdbc/rfid</Arg>
    <Arg>
      <New class="org.apache.tomcat.jdbc.pool.DataSource">
        <Set name="driverClassName">oracle.jdbc.OracleDriver</Set>
        <Set name="url">jdbc:oracle:thin:@integra:1521:integra</Set>
        <Set name="username">user</Set>
        <Set name="password">password</Set>
        <Set name="defaultAutoCommit">false</Set>
        <Set name="jmxEnabled">true</Set>
        <Set name="testWhileIdle">false</Set>
        <Set name="testOnBorrow">true</Set>
        <Set name="testOnReturn">false</Set>
        <Set name="validationQuery">SELECT 1 FROM dual</Set>
        <Set name="validationInterval">30000</Set>
        <Set name="minEvictableIdleTimeMillis">30000</Set>
        <Set name="timeBetweenEvictionRunsMillis">30000</Set>
        <Set name="initialSize">8</Set>
        <Set name="minIdle">8</Set>
        <Set name="maxIdle">8</Set>
        <Set name="maxActive">10</Set>
        <Set name="maxWait">30000</Set>
        <Set name="removeAbandonedTimeout">120</Set>
        <Set name="logAbandoned">true</Set>
        <Set name="removeAbandoned">true</Set>
        <Set name="jdbcInterceptors">
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(threshold=2000);
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;
        </Set>
      </New>
    </Arg>
  </New>

  <New id="myphoto" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jdbc/myphoto</Arg>
    <Arg>
      <New class="org.apache.tomcat.jdbc.pool.DataSource">
        <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
        <Set name="url">jdbc:mysql://localhost:3306/myphotoipb?zeroDateTimeBehavior=convertToNull&amp;useSSL=false</Set>
        <Set name="username">myphoto</Set>
        <Set name="password">password</Set>
        <Set name="defaultAutoCommit">false</Set>
        <Set name="jmxEnabled">true</Set>
        <Set name="testWhileIdle">false</Set>
        <Set name="testOnBorrow">true</Set>
        <Set name="testOnReturn">false</Set>
        <Set name="validationQuery">SELECT 1 FROM dual</Set>
        <Set name="validationInterval">30000</Set>
        <Set name="minEvictableIdleTimeMillis">30000</Set>
        <Set name="timeBetweenEvictionRunsMillis">30000</Set>
        <Set name="initialSize">2</Set>
        <Set name="minIdle">4</Set>
        <Set name="maxIdle">8</Set>
        <Set name="maxActive">10</Set>
        <Set name="maxWait">30000</Set>
        <Set name="removeAbandonedTimeout">120</Set>
        <Set name="logAbandoned">true</Set>
        <Set name="removeAbandoned">true</Set>
        <Set name="jdbcInterceptors">
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(threshold=2000);
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;
        </Set>
      </New>
    </Arg>
  </New>

jdbc/rfid
oracle.jdbc.OracleDriver
jdbc:oracle:thin:@integra:1521:integra
用户
密码
假的
真的
假的
真的
假的
从双重选择中选择1
30000
30000
30000
8.
8.
8.
10
30000
120
真的
真的
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(阈值=2000);
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;
jdbc/myphoto
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/myphotoipb?zeroDateTimeBehavior=convertToNull&usesl=false
我的照片
密码
假的
真的
假的
真的
假的
从双重选择中选择1
30000
30000
30000
2.
4.
8.
10
30000
120
真的
真的
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(阈值=2000);
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;

您应该能够通过JNDI访问,是的。文档提供了许多示例,但不可能涵盖所有场景。