JNDI is a very important standard in J2EE, usually in J2EE programming, Tomcat provides a method of using JNDI directly in JSP and Servelt, mainly through the DBCP connection pool, let me talk about me in Tomcat5.5 Methods of configuring and using JNDI. The object of this article is a reader who has been appreciated by J2EE, or has seen my BLOG: Tomcat's basic configuration instructions
First, add the following statement first in our own application web-inf directory:
resource-ref>
Then in the Tomcat directory /conf/server.xml file, see my BLOG: Tomcat's basic configuration instructions
JNDI configuration under Tomcat 5.5
Add as sub-elements:
Driverclassname = "com.pointbase.jdbc.jdbcuniversaldriver" "JDBC driver) URL = "JDBC: POINTBASE: Server: // localhost / ACME (database connection URL)" Username = "root" password = "root" maxactive = "20 (related configuration of connecting pool DBCP)" MaxIdle = "10" maxwait = "10000" /> Note, you have to copy your drive to common / lib, I use PointBase so I copy PBClient44.jar to Common / LIB (readers interested in PointBase can see my article PointBase database learning I also mentioned why I used the PointBase database as a explanation). Second, examples: The following is my hypothesis project acmeweb: Add in Web.xml of the corresponding program ..... resource-ref> web-app> Then I'm modified in Server.xml: Context> It is recommended that you write the above content into an XML file, copy it to the Conf / Catalina /