All Products
Search
Document Center

ApsaraDB for OceanBase:Example of configuring a Tomcat connection pool

Last Updated:Aug 01, 2023

This topic describes how to configure a Tomcat connection pool.

Configuration file

Modify the configuration of the Tomcat connection pool, as shown in the following example:

<Resource name="jdbc"
          auth="Container"
          type="javax.sql.DataSource"
          maxActive="100" //The maximum number of connections that a database can have on the server.
          maxIdle="30"    //The minimum number of connections that a database maintains on the server.
          maxWait="10000" //The maximum wait time. 10000 ms
          username="a****"
          password="******"
          driverClassName="com.oceanbase.jdbc.Driver"
          url="jdbc:oceanbase://xxx.xxx.xxx.xxx:3306/test?characterEncoding=UTF-8"
/>

Configure the project

After you modify the configuration file, configure the web.xml file for the project, as shown in the following example:

<resource-ref>
    <res-ref-name>jdbc</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>