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:
Basic configuration instructions for Tomcat
First, add the following statement first in our own application web-inf directory:
resource-ref>
Then look at my blog in the Tomcat directory /conf/server.xml file, look at my blog:
Basic configuration instructions for Tomcat
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 is pbclient44.jar to Common / LIB (readers interested in PointBase can see another 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 / Tomcat's basic configuration instructions and Tomcat documents. Author Blog: Http://blog.9cbs.net/jwsh1984/