| 1 |
<!-- |
| 2 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 |
contributor license agreements. See the NOTICE file distributed with |
| 4 |
this work for additional information regarding copyright ownership. |
| 5 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 |
(the "License"); you may not use this file except in compliance with |
| 7 |
the License. You may obtain a copy of the License at |
| 8 |
|
| 9 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
|
| 11 |
Unless required by applicable law or agreed to in writing, software |
| 12 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
See the License for the specific language governing permissions and |
| 15 |
limitations under the License. |
| 16 |
--> |
| 17 |
<html> |
| 18 |
<body> |
| 19 |
|
| 20 |
<p> |
| 21 |
This package contains one public class which is a |
| 22 |
<code>ConnectionPoolDataSource</code> (CPDS) implementation that can be used to |
| 23 |
adapt older <code>Driver</code> based jdbc implementations. Below is an |
| 24 |
example of setting up the CPDS to be available via JNDI in the |
| 25 |
catalina servlet container. |
| 26 |
</p> |
| 27 |
<p>In server.xml, the following would be added to the <Context> for your |
| 28 |
webapp: |
| 29 |
</p> |
| 30 |
|
| 31 |
<pre> |
| 32 |
<Resource name="jdbc/bookstoreCPDS" auth="Container" |
| 33 |
type="org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS"/> |
| 34 |
<ResourceParams name="jdbc/bookstoreCPDS"> |
| 35 |
<parameter> |
| 36 |
<name>factory</name> |
| 37 |
<value>org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS</value> |
| 38 |
</parameter> |
| 39 |
<parameter><name>user</name><value>root</value></parameter> |
| 40 |
<parameter><name>password</name><value></value></parameter> |
| 41 |
<parameter> |
| 42 |
<name>driver</name> |
| 43 |
<value>org.gjt.mm.mysql.Driver</value></parameter> |
| 44 |
<parameter> |
| 45 |
<name>url</name> |
| 46 |
<value>jdbc:mysql://localhost:3306/bookstore</value> |
| 47 |
</parameter> |
| 48 |
</ResourceParams> |
| 49 |
</pre> |
| 50 |
|
| 51 |
<p> |
| 52 |
In web.xml. Note that elements must be given in the order of the dtd |
| 53 |
described in the servlet specification: |
| 54 |
</p> |
| 55 |
|
| 56 |
<pre> |
| 57 |
<resource-ref> |
| 58 |
<description> |
| 59 |
Resource reference to a factory for java.sql.Connection |
| 60 |
instances that may be used for talking to a particular |
| 61 |
database that is configured in the server.xml file. |
| 62 |
</description> |
| 63 |
<res-ref-name> |
| 64 |
jdbc/bookstoreCPDS |
| 65 |
</res-ref-name> |
| 66 |
<res-type> |
| 67 |
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS |
| 68 |
</res-type> |
| 69 |
<res-auth> |
| 70 |
Container |
| 71 |
</res-auth> |
| 72 |
</resource-ref> |
| 73 |
</pre> |
| 74 |
|
| 75 |
<p> |
| 76 |
Catalina deploys all objects configured similarly to above within the |
| 77 |
<strong>java:comp/env</strong> namespace. |
| 78 |
</p> |
| 79 |
|
| 80 |
</body> |
| 81 |
</html> |