Difference between version and version      View first change»»

Back to JNDIDBCPExampleForMySQL5.x, or JNDIDBCPExampleForMySQL5.x version history

At line 1 changed 1 line.
!!!JNDI DBCP Example for MySQL 5.x
[{ALLOW edit neale}]
[{ALLOW upload neale}]
[{ALLOW rename neale}]
[{ALLOW view Anonymous,Asserted,Authenticated}]
!!![JNDI] [DBCP] Example for MySQL 5.x
At line 9 changed 1 line.
Save this file as <[your Application Root folder|Application Root]>/META-INF/[context.xml]
Save this file as <[webapps|webapps folder]>/<[your application folder (eg: ROOT)|Application Root]>/META-INF/[context.xml]
Note that most applications do not have a META-INF folder by default. Create it next to the WEB-INF folder, so that your application contains both a WEB-INF and a META-INF folder.
At line 19 changed 1 line.
url="jdbc:mysql://mysql5-external.metawerx.net:3306/YOUR_DATABASE_NAME?autoReconnect=true"
url="jdbc:mysql://mysql5.metawerx.net:3506/YOUR_DATABASE_NAME"
At line 27 added 4 lines.
removeAbandoned="true"
removeAbandonedTimeout="120"
logAbandoned="true"
maxWait="60"
At line 48 added 5 lines.
!Tips
* Remember to close your connections, especially after Exceptions, otherwise you will run out of connections. In this case your application will appear to have frozen, as it waits endlessly for a connection to become available from the pool. For more info, see [Connection Leak].
* When using [context.xml] or [server.xml] to initiate the pool in this way, the [JDBC] driver [JAR] file must be available in <jakarta>/common/lib. Simply placing it into <app>/WEB-INF/lib will not work. This is because the context starts before your application is loaded, so the WEB-INF/lib CLASSPATH does not exist at the time the connection pool is initiated.
* If you get a javax.naming.NameNotFoundException error, you have either not installed the [context.xml] file correctly, or have used a different name in the [context.xml] <Resource> element's "name" attribute to what you are using in your Context.lookup() call, or the JDBC jar file is not present in <jakarta>/common/lib.
At line 54 added 1 line.
* [Database Connection and Pooling Questions] (Metawerx FAQ from the Support Topics page)
At line 62 added 3 lines.
* [JNDI DBCP Example for Oracle]
* [Accessing a JNDI DataSource with JSTL from JSP]
* [Accessing a JNDI DataSource from Java]
navigation
metawerx specific
search
Share
tools
help

referring pages

Share