Tomcat configuration SQL Server Connection pool

Source: Internet
Author: User
Tags tomcat
1. Enter the Conf folder directory in the Tomcat directory, find Server.xml
In Tomcat's Server.xml file, in the </Context> tag and </Host> tab, negotiate the connection statement, in the following format
<!-path the directory of your application,/dbtest says in the Tomcat WebApps directory à
<!-docbase= "Dbtest" indicates the path name when you perform the stop program, for example, the following execution path is http://localhost:8080/dbtest-->
<context path= "/dbtest" docbase= "dbtest"
debug= "5" reloadable= "true" crosscontext= "true" >
<!--maxactive: Maximum number of connection pools, make sure there are enough connections-->
<!--Maxidle: Maximum number of idle connections, set to-1 means unrestricted-->
<!--maxwait: The maximum wait connection time (the time at which the largest waiting connection pool is available), in nanoseconds, set to 10000 equal to 10 seconds, and if set to-1 indicates uncertainty-->
<!--username and password: the account number and password used to connect to the database-->
<!--Driverclassname: A driver that connects to a database, such as SQL Server
Com.microsoft.jdbc.sqlserver.sqlserverdriver.-->
<!--URL: Connect the database path, such as
Jdbc:microsoft:sqlserver://localhost:1433;databasename=kb_rate-->



<resource name= "Default_jdbc" auth= "Container" type= "Javax.sql.DataSource"
Maxactive= "maxidle=" maxwait= "10000"
Username= "Javauser" password= "Javadude"
Driverclassname= "Com.microsoft.jdbc.sqlserver.SQLServerDriver"
Url= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=kb_rate" "/>



</Context>



After the configuration is complete, add a test file under the Dbtest directory, as follows:
<%@ page contenttype= "text/html;charset=gb2312"%>
<%@ page import= "java.sql.*"%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.