Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Howto/Configure JNDI Datasource"

< Jetty‎ | Howto
m
(BoneCP Connection Pool example added)
Line 14: Line 14:
 
     <res-auth>Container</res-auth>
 
     <res-auth>Container</res-auth>
 
   </resource-ref>
 
   </resource-ref>
</source>
+
 
  
 
These examples assume that all of the datasources are declared at the JVM scope, but you can, of course, use other scopes. You can configure all JNDI resources in a <code>jetty.xml</code> file or in a <code>WEB-INF/jetty-env.xml</code> file, or a context XML file. For more information, see [[Jetty/Feature/JNDI|JNDI]].
 
These examples assume that all of the datasources are declared at the JVM scope, but you can, of course, use other scopes. You can configure all JNDI resources in a <code>jetty.xml</code> file or in a <code>WEB-INF/jetty-env.xml</code> file, or a context XML file. For more information, see [[Jetty/Feature/JNDI|JNDI]].
Line 22: Line 22:
 
Enables connection pooling. Connection pooling lets you reuse an existing connection instead of creating a new connection to the database.This is highly efficient in terms of memory allocation and speed of the request to the database. We highly recommend this option for production environments.
 
Enables connection pooling. Connection pooling lets you reuse an existing connection instead of creating a new connection to the database.This is highly efficient in terms of memory allocation and speed of the request to the database. We highly recommend this option for production environments.
  
===c3p0===
+
===BoneCP===
  
Connection pooling, available at http://repo1.maven.org/maven2/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar
+
Connection pooling, available at http://jolbox.com/index.html?page=http://jolbox.com/download.html
 +
All configuration options for BoneCP are described here: http://jolbox.com/bonecp/downloads/site/apidocs/com/jolbox/bonecp/BoneCPDataSource.html
  
 
<source lang="xml">
 
<source lang="xml">
Line 31: Line 32:
 
     <Arg>jdbc/DSTest</Arg>
 
     <Arg>jdbc/DSTest</Arg>
 
     <Arg>
 
     <Arg>
      <New class="com.mchange.v2.c3p0.ComboPooledDataSource">
+
      <New class="com.jolbox.bonecp.BoneCPDataSource">
         <Set name="driverClass">org.some.Driver</Set>
+
         <Set name="driverClass">com.mysql.jdbc.Driver</Set>
 
         <Set name="jdbcUrl">jdbc.url</Set>
 
         <Set name="jdbcUrl">jdbc.url</Set>
         <Set name="user">jdbc.user</Set>
+
         <Set name="username">jdbc.user</Set>
 
         <Set name="password">jdbc.pass</Set>
 
         <Set name="password">jdbc.pass</Set>
 +
        <Set name="minConnectionsPerPartition">5</Set>
 +
        <Set name="maxConnectionsPerPartition">50</Set>
 +
        <Set name="acquireIncrement">5</Set>
 +
        <Set name="idleConnectionTestPeriod">30</Set>
 
       </New>
 
       </New>
    </Arg>
+
    </Arg>
    </New>
+
  </New>
</source>
+
 
 +
 
 +
===c3p0===
 +
 
 +
Connection pooling, available at http://repo1.maven.org/maven2/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar
 +
 
 +
<source lang="xml">
 +
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
 +
    <arg></arg>
 +
    <arg>jdbc/DSTest</arg>
 +
    <arg>
 +
      <new class="com.mchange.v2.c3p0.ComboPooledDataSource">
 +
        <set name="driverClass">org.some.Driver</set>
 +
        <set name="jdbcUrl">jdbc.url</set>
 +
        <set name="user">jdbc.user</set>
 +
        <set name="password">jdbc.pass</set>
 +
      </new>
 +
    </arg>
 +
    </new>
 +
 
  
 
===dbcp===
 
===dbcp===
Line 46: Line 70:
  
 
<source lang="xml">
 
<source lang="xml">
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="org.apache.commons.dbcp.BasicDataSource">
+
         <new class="org.apache.commons.dbcp.BasicDataSource">
             <Set name="driverClassName">org.some.Driver</Set>
+
             <set name="driverClassName">org.some.Driver</set>
             <Set name="url">jdbc.url</Set>
+
             <set name="url">jdbc.url</set>
             <Set name="username">jdbc.user</Set>
+
             <set name="username">jdbc.user</set>
             <Set name="password">jdbc.pass</Set>
+
             <set name="password">jdbc.pass</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
     </New>
+
     </new>
</source>
+
 
  
 
===Atomikos 3.3.2+===
 
===Atomikos 3.3.2+===
Line 65: Line 89:
  
 
<source lang="xml">
 
<source lang="xml">
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
       <Arg></Arg>
+
       <arg></arg>
       <Arg>jdbc/DSTest</Arg>
+
       <arg>jdbc/DSTest</arg>
       <Arg>
+
       <arg>
         <New class="com.atomikos.jdbc.AtomikosDataSourceBean">
+
         <new class="com.atomikos.jdbc.AtomikosDataSourceBean">
             <Set name="minPoolSize">2</Set>
+
             <set name="minPoolSize">2</set>
             <Set name="maxPoolSize">50</Set>
+
             <set name="maxPoolSize">50</set>
             <Set name="xaDataSourceClassName">com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</Set>
+
             <set name="xaDataSourceClassName">com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</set>
             <Set name="UniqueResourceName">DSTest</Set>
+
             <set name="UniqueResourceName">DSTest</set>
             <Get name="xaProperties">
+
             <get name="xaProperties">
               <Call name="setProperty">
+
               <call name="setProperty">
                   <Arg>url</Arg>
+
                   <arg>url</arg>
                   <Arg>jdbc:mysql://localhost:3306/databasename</Arg>
+
                   <arg>jdbc:mysql://localhost:3306/databasename</arg>
               </Call>
+
               </call>
               <Call name="setProperty">
+
               <call name="setProperty">
                   <Arg>user</Arg>
+
                   <arg>user</arg>
                   <Arg>some_username</Arg>
+
                   <arg>some_username</arg>
               </Call>
+
               </call>
               <Call name="setProperty">
+
               <call name="setProperty">
                   <Arg>password</Arg>
+
                   <arg>password</arg>
                   <Arg>some_password</Arg>
+
                   <arg>some_password</arg>
               </Call>
+
               </call>
             </Get>
+
             </get>
         </New>
+
         </new>
       </Arg>
+
       </arg>
     </New>
+
     </new>
</source>
+
 
  
 
==Non-pooling DataSources==
 
==Non-pooling DataSources==
Line 102: Line 126:
  
 
<source lang="xml">  
 
<source lang="xml">  
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
+
         <new class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
           <Set name="Url">jdbc:mysql://localhost:3306/databasename</Set>
+
           <set name="Url">jdbc:mysql://localhost:3306/databasename</set>
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
     </New>
+
     </new>
</source>
+
 
  
 
===SQL Server 2000===
 
===SQL Server 2000===
Line 120: Line 144:
  
 
<source lang="xml">
 
<source lang="xml">
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
+
         <new class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
           <Set name="DatabaseName">dbname</Set>
+
           <set name="DatabaseName">dbname</set>
           <Set name="ServerName">localhost</Set>
+
           <set name="ServerName">localhost</set>
           <Set name="PortNumber">1433</Set>
+
           <set name="PortNumber">1433</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
     </New>
+
     </new>
</source>
+
 
  
 
===Oracle 9i/10g===
 
===Oracle 9i/10g===
Line 140: Line 164:
  
 
<source lang="xml">  
 
<source lang="xml">  
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
       <New class="oracle.jdbc.pool.OracleDataSource">
+
       <new class="oracle.jdbc.pool.OracleDataSource">
         <Set name="DriverType">thin</Set>
+
         <set name="DriverType">thin</set>
         <Set name="URL">jdbc:oracle:thin:@fmsswdb1:10017:otcd</Set>
+
         <set name="URL">jdbc:oracle:thin:@fmsswdb1:10017:otcd</set>
         <Set name="User">xxxx</Set>
+
         <set name="User">xxxx</set>
         <Set name="Password">xxxx</Set>
+
         <set name="Password">xxxx</set>
         <Set name="connectionCachingEnabled">true</Set>
+
         <set name="connectionCachingEnabled">true</set>
         <Set name="connectionCacheProperties">
+
         <set name="connectionCacheProperties">
           <New class="java.util.Properties">
+
           <new class="java.util.Properties">
             <Call name="setProperty">
+
             <call name="setProperty">
               <Arg>MinLimit</Arg>
+
               <arg>MinLimit</arg>
               <Arg>5</Arg>
+
               <arg>5</arg>
             </Call>
+
             </call>
 
             <!-- put the other properties in here too -->
 
             <!-- put the other properties in here too -->
           </New>
+
           </new>
         </Set>
+
         </set>
       </New>
+
       </new>
     </Arg>
+
     </arg>
   </New>
+
   </new>
</source>
+
 
  
 
For more information please see [http://download.oracle.com/docs/cd/B14117_01/java.101/b10979/conncache.htm#CDEBCBJC|this link].
 
For more information please see [http://download.oracle.com/docs/cd/B14117_01/java.101/b10979/conncache.htm#CDEBCBJC|this link].
Line 171: Line 195:
  
 
<source lang="xml">
 
<source lang="xml">
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="org.postgresql.ds.PGSimpleDataSource">
+
         <new class="org.postgresql.ds.PGSimpleDataSource">
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
           <Set name="DatabaseName">dbname</Set>
+
           <set name="DatabaseName">dbname</set>
           <Set name="ServerName">localhost</Set>
+
           <set name="ServerName">localhost</set>
           <Set name="PortNumber">5432</Set>
+
           <set name="PortNumber">5432</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
   </New>
+
   </new>
</source>
+
 
  
 
Implements javax.sql.ConnectionPoolDataSource
 
Implements javax.sql.ConnectionPoolDataSource
  
 
<source lang="xml">  
 
<source lang="xml">  
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="org.postgresql.ds.PGConnectionPoolDataSource">
+
         <new class="org.postgresql.ds.PGConnectionPoolDataSource">
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
           <Set name="DatabaseName">dbname</Set>
+
           <set name="DatabaseName">dbname</set>
           <Set name="ServerName">localhost</Set>
+
           <set name="ServerName">localhost</set>
           <Set name="PortNumber">5432</Set>
+
           <set name="PortNumber">5432</set>
 
   
 
   
         </New>
+
         </new>
     </Arg>
+
     </arg>
   </New>
+
   </new>
</source>
+
 
  
 
===Sybase===
 
===Sybase===
Line 210: Line 234:
  
 
<source lang="xml">
 
<source lang="xml">
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="com.sybase.jdbc2.jdbc.SybDataSource">
+
         <new class="com.sybase.jdbc2.jdbc.SybDataSource">
           <Set name="DatabaseName">dbname</Set>
+
           <set name="DatabaseName">dbname</set>
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
           <Set name="ServerName">servername</Set>
+
           <set name="ServerName">servername</set>
           <Set name="PortNumber">5000</Set>
+
           <set name="PortNumber">5000</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
   </New>
+
   </new>
</source>
+
 
  
 
===DB2===
 
===DB2===
Line 230: Line 254:
  
 
<source lang="xml">  
 
<source lang="xml">  
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="com.ibm.db2.jcc.DB2SimpleDataSource">
+
         <new class="com.ibm.db2.jcc.DB2SimpleDataSource">
           <Set name="DatabaseName">dbname</Set>
+
           <set name="DatabaseName">dbname</set>
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
           <Set name="ServerName">servername</Set>
+
           <set name="ServerName">servername</set>
           <Set name="PortNumber">50000</Set>
+
           <set name="PortNumber">50000</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
   </New>
+
   </new>
</source>
+
 
  
 
Implements javax.sql.ConnectionPoolDataSource
 
Implements javax.sql.ConnectionPoolDataSource
  
 
<source lang="xml">
 
<source lang="xml">
   <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
+
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
+
     <arg></arg>
     <Arg>jdbc/DSTest</Arg>
+
     <arg>jdbc/DSTest</arg>
     <Arg>
+
     <arg>
         <New class="com.ibm.db2.jcc.DB2ConnectionPoolDataSource">
+
         <new class="com.ibm.db2.jcc.DB2ConnectionPoolDataSource">
           <Set name="DatabaseName">dbname</Set>
+
           <set name="DatabaseName">dbname</set>
           <Set name="User">user</Set>
+
           <set name="User">user</set>
           <Set name="Password">pass</Set>
+
           <set name="Password">pass</set>
           <Set name="ServerName">servername</Set>
+
           <set name="ServerName">servername</set>
           <Set name="PortNumber">50000</Set>
+
           <set name="PortNumber">50000</set>
         </New>
+
         </new>
     </Arg>
+
     </arg>
   </New>
+
   </new>
</source>
+
 
 
}}
 
}}

Revision as of 10:55, 27 January 2012

{{Jetty Howto | introduction = This document provides examples of configuring a JNDI datasource for various databases.

Idea.png
Tip:
Read the generic JNDI instructions for background information about configuring datasources.


These examples all correspond to a <resource-ref> in web.xml:

  <resource-ref>
     <description>My DataSource Reference</description>
     <res-ref-name>jdbc/DSTest</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
  </resource-ref>
 
 
These examples assume that all of the datasources are declared at the JVM scope, but you can, of course, use other scopes. You can configure all JNDI resources in a <code>jetty.xml</code> file or in a <code>WEB-INF/jetty-env.xml</code> file, or a context XML file. For more information, see [[Jetty/Feature/JNDI|JNDI]].
 
==Pooling DataSources==
 
Enables connection pooling. Connection pooling lets you reuse an existing connection instead of creating a new connection to the database.This is highly efficient in terms of memory allocation and speed of the request to the database. We highly recommend this option for production environments.
 
===BoneCP===
 
Connection pooling, available at http://jolbox.com/index.html?page=http://jolbox.com/download.html
All configuration options for BoneCP are described here: http://jolbox.com/bonecp/downloads/site/apidocs/com/jolbox/bonecp/BoneCPDataSource.html
 
<source lang="xml">
  <New id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
     <Arg>jdbc/DSTest</Arg>
     <Arg>
       <New class="com.jolbox.bonecp.BoneCPDataSource">
         <Set name="driverClass">com.mysql.jdbc.Driver</Set>
         <Set name="jdbcUrl">jdbc.url</Set>
         <Set name="username">jdbc.user</Set>
         <Set name="password">jdbc.pass</Set>
         <Set name="minConnectionsPerPartition">5</Set>
         <Set name="maxConnectionsPerPartition">50</Set>
         <Set name="acquireIncrement">5</Set>
         <Set name="idleConnectionTestPeriod">30</Set>
      </New>
    </Arg>
  </New>
 
 
===c3p0===
 
Connection pooling, available at http://repo1.maven.org/maven2/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar
 
<source lang="xml">
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
      <new class="com.mchange.v2.c3p0.ComboPooledDataSource">
         <set name="driverClass">org.some.Driver</set>
         <set name="jdbcUrl">jdbc.url</set>
         <set name="user">jdbc.user</set>
         <set name="password">jdbc.pass</set>
      </new>
     </arg>
    </new>
 
 
===dbcp===
 
Connection pooling, available at http://repo1.maven.org/maven2/commons-dbcp/commons-dbcp/1.2/commons-dbcp-1.2.jar
 
<source lang="xml">
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
         <new class="org.apache.commons.dbcp.BasicDataSource">
            <set name="driverClassName">org.some.Driver</set>
            <set name="url">jdbc.url</set>
            <set name="username">jdbc.user</set>
            <set name="password">jdbc.pass</set>
         </new>
     </arg>
    </new>
 
 
===Atomikos 3.3.2+===
 
Connection pooling + XA transactions.
 
<source lang="xml">
   <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
      <arg></arg>
      <arg>jdbc/DSTest</arg>
      <arg>
         <new class="com.atomikos.jdbc.AtomikosDataSourceBean">
            <set name="minPoolSize">2</set>
            <set name="maxPoolSize">50</set>
            <set name="xaDataSourceClassName">com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</set>
            <set name="UniqueResourceName">DSTest</set>
            <get name="xaProperties">
               <call name="setProperty">
                  <arg>url</arg>
                  <arg>jdbc:mysql://localhost:3306/databasename</arg>
               </call>
               <call name="setProperty">
                  <arg>user</arg>
                  <arg>some_username</arg>
               </call>
               <call name="setProperty">
                  <arg>password</arg>
                  <arg>some_password</arg>
               </call>
            </get>
         </new>
      </arg>
    </new>
 
 
==Non-pooling DataSources==
 
If you are deploying in a production environment, use the Pooling DataSources instead.
 
===MySQL===
 
Implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource
 
<source lang="xml"> 
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
           <set name="Url">jdbc:mysql://localhost:3306/databasename</set>
           <set name="User">user</set>
           <set name="Password">pass</set>
        </new>
     </arg>
    </new>
 
 
===SQL Server 2000===
 
Implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource
 
<source lang="xml">
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
           <set name="User">user</set>
           <set name="Password">pass</set>
           <set name="DatabaseName">dbname</set>
           <set name="ServerName">localhost</set>
           <set name="PortNumber">1433</set>
        </new>
     </arg>
    </new>
 
 
===Oracle 9i/10g===
 
Implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource
 
<source lang="xml"> 
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
    <arg></arg>
    <arg>jdbc/DSTest</arg>
    <arg>
      <new class="oracle.jdbc.pool.OracleDataSource">
        <set name="DriverType">thin</set>
        <set name="URL">jdbc:oracle:thin:@fmsswdb1:10017:otcd</set>
        <set name="User">xxxx</set>
        <set name="Password">xxxx</set>
        <set name="connectionCachingEnabled">true</set>
        <set name="connectionCacheProperties">
          <new class="java.util.Properties">
            <call name="setProperty">
              <arg>MinLimit</arg>
              <arg>5</arg>
            </call>
            <!-- put the other properties in here too -->
          </new>
        </set>
      </new>
    </arg>
  </new>
 
 
For more information please see [http://download.oracle.com/docs/cd/B14117_01/java.101/b10979/conncache.htm#CDEBCBJC|this link].
 
===PostgreSQL===
 
Implements javax.sql.DataSource
 
<source lang="xml">
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="org.postgresql.ds.PGSimpleDataSource">
           <set name="User">user</set>
           <set name="Password">pass</set>
           <set name="DatabaseName">dbname</set>
           <set name="ServerName">localhost</set>
           <set name="PortNumber">5432</set>
        </new>
     </arg>
  </new>
 
 
Implements javax.sql.ConnectionPoolDataSource
 
<source lang="xml"> 
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="org.postgresql.ds.PGConnectionPoolDataSource">
           <set name="User">user</set>
           <set name="Password">pass</set>
           <set name="DatabaseName">dbname</set>
           <set name="ServerName">localhost</set>
           <set name="PortNumber">5432</set>
 
        </new>
     </arg>
  </new>
 
 
===Sybase===
 
Implements javax.sql.DataSource
 
<source lang="xml">
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="com.sybase.jdbc2.jdbc.SybDataSource">
           <set name="DatabaseName">dbname</set>
           <set name="User">user</set>
           <set name="Password">pass</set>
           <set name="ServerName">servername</set>
           <set name="PortNumber">5000</set>
        </new>
     </arg>
  </new>
 
 
===DB2===
 
Implements javax.sql.DataSource
 
<source lang="xml"> 
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="com.ibm.db2.jcc.DB2SimpleDataSource">
           <set name="DatabaseName">dbname</set>
           <set name="User">user</set>
           <set name="Password">pass</set>
           <set name="ServerName">servername</set>
           <set name="PortNumber">50000</set>
        </new>
     </arg>
  </new>
 
 
Implements javax.sql.ConnectionPoolDataSource
 
<source lang="xml">
  <new id="DSTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <arg></arg>
     <arg>jdbc/DSTest</arg>
     <arg>
        <new class="com.ibm.db2.jcc.DB2ConnectionPoolDataSource">
           <set name="DatabaseName">dbname</set>
           <set name="User">user</set>
           <set name="Password">pass</set>
           <set name="ServerName">servername</set>
           <set name="PortNumber">50000</set>
        </new>
     </arg>
  </new>
 
}}

Copyright © Eclipse Foundation, Inc. All Rights Reserved.