adspace


What are the steps for the creation of Pooling within Tomcat server?

Answer Posted / Guddu Kumar Gunjan

Creating a connection pool in Tomcat involves configuring the `database.properties` file and setting up the `Context` in the `server.xml` file. Here's how to create a connection pool: 1. Define the JDBC driver class, username, password, and URL for your database in the `database.properties` file. 2. In the `Context` element of the desired `Host` or `Engine`, set up a Resource parameter with the name and type of the resource to be pooled (e.g., `jdbc/myDatabase`). 3. Define a `JdbcDataSource` bean in the `web-app/WEB-INF/web.xml` file, setting its properties like driver class, URL, username, password, and connection properties (pool settings). 4. Reference the created resource in your application code by looking up the DataSource using JNDI lookup (e.g., `DataSource ds = (DataSource) context.lookup("java:comp/env/jdbc/myDatabase");`)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to disable jsessionid in tomcat servlet?

1009


Which version of apache have you worked on?

921