Third-party Database Configuration
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Servlets and Filters
Portlets
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Configuration
Third-party
Cookbook
Tutorials
Scrapbook
Configuration
Databases
Cookbook

  1. MySQL Connector/J
    1. Not all MySQL table types support transactions
  2. Oracle
  3. Informix
  4. SQL Server
  5. DB2
  6. Interbase
  7. PostgreSQL
  8. hsqldb

MySQL Connector/J

MySQL Connector/J JDBC configuration
<database>
  <jndi-name>jdbc/mysql</jndi-name>
  <driver>
    <type>com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource</type>
    <url>jdbc:mysql://localhost:3306/dbname</url>
    <user>username</user>
    <password>password</password>
  </driver>
  ...
</database>

Not all MySQL table types support transactions

TODO

Oracle

Oracle JDBC configuration
<database>
  <jndi-name>jdbc/oracle</jndi-name>
  <driver>
    <type>oracle.jdbc.pool.OracleConnectionPoolDataSource</type>
    <url>jdbc:oracle:thin:@localhost:1521:dbname</url>
    <user>username</user>
    <password>password</password>
  </driver>
  ...
</database>

Note, the XADataSource is only needed for distributed transactions. If your transactions only include the single data source, the OracleConnectionPoolDataSource will be more efficient.

Oracle XADataSource JDBC configuration
<database>
  <jndi-name>jdbc/oracle-xa</jndi-name>
  <xa>true</xa>
  <driver>
    <type>oracle.jdbc.xa.client.OracleXADataSource</type>
    <url>jdbc:oracle:thin:@localhost:1521:dbname</url>
    <user>username</user>
    <password>password</password>
  </driver>
  ...
</database>

Informix

Informix JDBC configuration
<database>
  <jndi-name>jdbc/informix</jndi-name>
  <driver>
    <type>com.informix.jdbcx.IfxConnectionPoolDataSource</type>
    <url>jdbc:informix-sqli://123.45.67.89:1533/dbname</url>
    <init-param param-name="INFORMIXSERVER" param-value="myserver"/>
    <user>username</user>
    <password>password</password>
  </driver>
  ...
</database>

Informix XADataSource JDBC configuration
<database>
  <jndi-name>jdbc/informix-xa</jndi-name>
  <xa>true</xa>
  <driver type="com.informix.jdbcx.IfxXADataSource">
    <url>jdbc:informix-sqli://123.45.67.89:1533/dbname</url>
    <init-param param-name="INFORMIXSERVER" param-value="myserver"/>
    <user>username</user>
    <password>password</password>
  </driver>
  ...
</database>

SQL Server

<database>
  <jndi-name>jdbc/sqlserver</jndi-name>
  <driver type="com.microsoft.jdbcx.sqlserver.SQLServerDataSource">
    <serverName>csdevsqla01.office.foo</serverName>
    <databaseName>Reports</databaseName>
    <user>XXX</user>
    <password>YYY</password>
    <selectMethod>cursor</selectMethod>
  </driver>
  <xa>true</xa>
</database>

DB2

Contributions welcome!

Interbase

Contributions welcome!

PostgreSQL

<database>
  <jndi-name>jdbc/name</jndi-name>
  <driver>
    <type>org.postgresql.Driver</type>
    <url>jdbc:postgresql://127.0.0.1:5432/dbname</url>
    <user>username</user>
    <password>password</password>
  </driver>
  ...
</database>

hsqldb

"hsqldb is a relational database engine written in Java. It offers a small (less than 160k), fast database engine which offers both in memory and disk based tables."

Contributions welcome!


Configuration
Databases
Cookbook
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.