Spring通过JNDI获取在Tomcat容器中配置的C3P0数据源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!-- DBCP连接池 -->
    <Resource name="jdbc/gdDB" auth="Container" type="javax.sql.DataSource"
    username="scott" password="tiger" driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@localhost:1521:orcl"
    testOnBorrow="true"
    testOnReturn="true"
    testWhileIdle="true"
    validationQuery="SELECT COUNT(*) FROM DUAL"
    maxIdle="30"
    maxWait="5000"
    maxActive="100"
    initialSize="10"/>
                                                                                                                                                                                                                                           
    <!-- C3P0连接池 -->
    <Resource name="jdbc/DB" auth="Container"
    user="scott" password="tiger" driverClass="oracle.jdbc.driver.OracleDriver"
    jdbcUrl="jdbc:oracle:thin:@localhost:1521:orcl"
    maxPoolSize="30"
    minPoolSize="1"
    initialPoolSize="5"
    acquireIncrement="2"
    idleConnectionTestPeriod="60"
    maxIdleTime="60"
    factory="org.apache.naming.factory.BeanFactory"
    type="com.mchange.v2.c3p0.ComboPooledDataSource"/>
1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- 配置JNDI数据源 -->
   <bean id="dataSource"
       class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName">
          <!--  <value>java:comp/env/jdbc/c3p0DB</value> -->
          <value>java:comp/env/jdbc/DB</value>
       </property>
   </bean>
   <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
       <property name="dataSource">
           <ref bean="dataSource" />
       </property>
   </bean>
1.javax.naming.NamingException: No set method found for property: username

Spring通过JNDI获取在Tomcat容器中配置的C3P0数据源,布布扣,bubuko.com

Spring通过JNDI获取在Tomcat容器中配置的C3P0数据源

上一篇:Google V8编程详解(三)Handle & HandleScope


下一篇:Nginx下用webbench进行压力测试