Jetty has moved!
Jetty is a project at the Eclipse Foundation.
Homepage:http://www.eclipse.org/jetty
Downloads: http://download.eclipse.org/jetty/
Documentation:http://www.eclipse.org/jetty/documentation/current/
About:http://www.eclipse.org/jetty/about.php
Jetty Powered:http://www.eclipse.org/jetty/powered/
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

NB: Please read through the generic JNDI instrutions for the background to configuring datasources.

DataSource Examples

Here are some examples of setting up a DataSource in JNDI for various databases.

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

For convenience, we will assume that all of the datasources are declared at the jvm scope, but you can of course use other scopes, as discussed here.

Don't forget that all JNDI resources can be configured in a jetty.xml file or in a WEB-INF/jetty-env.xml file, or a context xml file. More information on that can be found on the page on JNDI.

Pooling DataSources

Enables connection pooling.
Connection pooling is basically re-using existing connections instead of creating a new connection to the database.
This would be highly efficient in terms of memory allocation and speed of the request to the database.
In production, this is highly recommended.

c3p0 (connection pooling)

available at http://repo1.maven.org/maven2/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar

dbcp (connection pooling)

available at http://repo1.maven.org/maven2/commons-dbcp/commons-dbcp/1.2/commons-dbcp-1.2.jar

Atomikos 3.3.2+ (connection pooling + XA transactions)

Non-pooling DataSources

If you're deploying in production environment, use the #Pooling DataSources instead.

MySQL

implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource

SQL Server 2000

implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource

Oracle 9i/10g

implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource

PostgreSQL

implements javax.sql.DataSource

implements javax.sql.ConnectionPoolDataSource

Sybase

implements javax.sql.DataSource

DB2

implements javax.sql.DataSource

implements javax.sql.ConnectionPoolDataSource

  • No labels
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery