Debian Codegraph @

src/java/org/apache/commons/dbcp/cpdsadapter/package.html

raw
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 &lt;Context&gt; for your
28 webapp:
29 </p>
30
31 <pre>
32 &lt;Resource name="jdbc/bookstoreCPDS" auth="Container"
33 type="org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS"/&gt;
34 &lt;ResourceParams name="jdbc/bookstoreCPDS"&gt;
35 &lt;parameter&gt;
36 &lt;name&gt;factory&lt;/name&gt;
37 &lt;value&gt;org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS&lt;/value&gt;
38 &lt;/parameter&gt;
39 &lt;parameter&gt;&lt;name&gt;user&lt;/name&gt;&lt;value&gt;root&lt;/value&gt;&lt;/parameter&gt;
40 &lt;parameter&gt;&lt;name&gt;password&lt;/name&gt;&lt;value&gt;&lt;/value&gt;&lt;/parameter&gt;
41 &lt;parameter&gt;
42 &lt;name&gt;driver&lt;/name&gt;
43 &lt;value&gt;org.gjt.mm.mysql.Driver&lt;/value&gt;&lt;/parameter&gt;
44 &lt;parameter&gt;
45 &lt;name&gt;url&lt;/name&gt;
46 &lt;value&gt;jdbc:mysql://localhost:3306/bookstore&lt;/value&gt;
47 &lt;/parameter&gt;
48 &lt;/ResourceParams&gt;
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 &lt;resource-ref&gt;
58 &lt;description&gt;
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 &lt;/description&gt;
63 &lt;res-ref-name&gt;
64 jdbc/bookstoreCPDS
65 &lt;/res-ref-name&gt;
66 &lt;res-type&gt;
67 org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
68 &lt;/res-type&gt;
69 &lt;res-auth&gt;
70 Container
71 &lt;/res-auth&gt;
72 &lt;/resource-ref&gt;
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>