Set the database connection pool BoneCP

Why should we do with the database connection pool? Ground to online search, the basic principles of a lot of code is a lot, because of his right Bijiao Shu, java is started, a little health, so much trouble to write their own, so that a web search, there are many open-source open-source database connection pool, its own recommended for BoneCP;
He had just started to write jsp, Therefore, the use of the IDE is NetBeans, which IDE to use the same fact, as long as you put these as Notepad or editplus on usage are similar, but in fact, or is it a bit different.

Their own development environment:
1. jdk6.0
2. tomcat 6.0.20 (zip version, do not use the exe version, because that version does not have much control over the script)
3. NetBeans 6.7.1
4. The system classpath is set with jdk6.0 and tomcat's lib

But before then: tomcat for each Web application (Web site) of the WEB-INF in this folder, and classes in the lib folder in the Web application on the staged position, therefore, to import a library, just the corresponding jar file into WEB-INF location of the lib can call, do not need to set up in the WEB-INF/web.xml inside. (In fact, here seen as the production environment)

Setting process begins:
1. Create a java web project, in the WEB-INF create a new lib folder structure shown in Figure
Set the database connection pool BoneCP

2. Download package
Note: Because I have here is only jsp development environment, does not contain any of the java framework, therefore, can not directly use the jar, the corresponding need to import the jar referenced jar


Note that we must import these two packages,
(Official incidentally mentioned a moment, but placed in obvious places
You will also need SLF4J and Google Collections library as described in the requirements page.), So I walked a lot of detours to see your best to compile their own process to see what is wrong will be reported!

3. Import Package Here we must mention the next, NetBeans default staged (you can say classpath) does not include WEB-INF/lib and WEB-INF/classes
So, if you direct this directly dumped into these positions of several packages, compile the above it will still Baocuo WEB-INF/lib placed on the number of packets, after further action needs to be done, right click on the above picture of the library, Click Add jar, and then select those few jar, that is to tell NetBeans, classpath to include in the file path of this jar. This can be found at compile time the appropriate jar.
Note that the system classpath variable, IDE's classpath, the deployment of Web applications running on classpath, when the difference between the three

4. As usual to write the database connection, examples of official there, actually, written and connections are similar, just java internal mode of operation has changed nothing!

分类:Java 时间:2010-03-29 人气:451
blog comments powered by Disqus


  • hadoop in the windows configuration and run under (operating environment and the development environment configuration) 2010-08-15

    Hadoop in Windows, before deployment, the software will need to install cygwin, then let's look at how to install and configure cygwin 1, cygwin installation and configuration 1 What is cygwin cygwin is a unix running on windows platform simulation e

  • How to connect sql server database connection pool configuration Tomcat 2010-02-24

    How to connect SQL Server database (Tomcat connection pool configuration) (reproduced) Source: Version is relatively new, on-line many are saying is Tomcat 4, this is 5.0. How to connect SQL Se

  • Database connection pool - java 2011-06-10

    Java applications access the database of the basic principles of In the Java language, JDBC (Java DataBase Connection) is a database application with a bridge, or the Java language to access the database through JDBC technology. JDBC is an "open"

  • SqlServer database connection pool to connect tomcat 2009-03-01

    First, install the JDBC Driver The database driver jar file to put (Tomcat_install) \ common \ lib directory Second, configure the Connection Pool 1. Overall connection pool configuration, Tomcat in any Web application can be configured to use the co

  • hibernate configuration data source. hibernate - Database Connection Pool 2009-04-30

    In order to configure their own testing environment, and required their entire framework of the abstract, the introduction of the test framework, the tests have their own test cases. Database connection pool but found the old problems, questions and

  • DBCP database connection pool 2010-06-24

    Concepts: database connection pool for distribution, management and release database connections, it allows applications to reuse an existing database connection, instead of re-establishing a connection; release of free time over the maximum idle tim

  • Configuring database connection pool-C3P0 2010-08-03

    >> Transfer from: Recent often upgrade and database and network equipment relocation issues, and all applications are based on the database connection pool to do, most are based on t

  • Java connection pool using the Oracle database connection 2010-10-26

    1.Java four methods of connecting to the database program 1 JDBC-ODBC bridge and ODBC driver - in this way, this is a local solution, because the ODBC driver and the bridge code must appear in each user's machine. Fundamentally, this is a temporary s

  • Java connection pool using Oracle database 2010-10-26

    1.Java four methods to connect the database 1 JDBC-ODBC bridge and ODBC driver - in this way, this is a local solution, because the ODBC driver and the bridge code must appear in each user's machine. Basically this is a temporary solution. 2 native c

  • JDBC database connection pool Statment 2010-09-08

    1. Foreword   database applications, in many software systems are often used, is indispensable for the development of supporting large-scale systems. But if not well managed database resources (such as: failure to make timely recovery of the databa

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.542 (s). 12 q(s)