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 asp.net 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
BoneCP http://jolbox.com/index.html
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

slf4j http://www.slf4j.org/
google-collections http://code.google.com/p/google-collections/

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!
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Set the database connection pool BoneCP

  • java read file

    java read documents in two ways: java.io and java.lang.ClassLoader When using the java.io, when java.lang.ClassLoader use it? (Note: If prior to read xml file java read file clearly aware of these two methods have been like! Can take much less to understa

  • Spring + Hibernate to use Glassfish Database Connection Pool

    applicationContext.xml file content <? xml version = "1.0" encoding = "UTF-8"?> <beans xmlns = " http://www.springframework.org/schema/beans " xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance " ...

  • JAVA EE JSP_JNDI

    dsfdsa http://lindows.javaeye.com/admin/blogs/213348 Tomcat 6 with the connection pool data source configuration http://www.blogjava.net/ec2008/archive/2008/07/19/216063.html project: test Driver path: D: \ workspace \ test \ WebRoot \ WEB-INF \ lib ...

  • Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL

    [Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

  • hibernate to use the principle of

    The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...

  • Servlet brief introduction

    Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to run thread Servlet API for Servlet provides the s ...

  • spring struts2.0 hibernate environmental structures .. despair carried out more than one hour only with good.

    http://www.qqread.com/java/2008/06/f413762.html Look here. . Note added myeclipse support spring when necessary add the commons-dbcp database connection pool package. And to add hibernate support. . Finally add struts2 support. . Oh the lazy point. . . fu

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries