public class InformixDataSource extends org.apache.avalon.framework.logger.AbstractLogEnabled implements DataSourceComponent
com.informix.jdbcx.IfxConnectionPoolDataSource object. It uses
the following format for configuration (italics mark information you change):
<informix>
<pool-controller init="5" min="5" max="10"/>
<dbname>dbname</dbname>
<servername>servername</servername>
<host port="2000">host</host>
<user>user</user>
<password>password</password>
<tracing>
<jdbc> file="filename" level="level"</jdbc>
<sqli> file="filename" level="level"</sqli>
</tracing>
<informix>
Informix doesn't like the JdbcDataSource Component, so we gave it it's own. Do not use this datasource if you are planning on using your J2EE server's connection pooling.
You must have Informix's JDBC 2.2 or higher jar file, as well as the
extensions jar file (ifxjdbc.jar and ifxjdbcx.jar).
Also, this DataSource requires the Avalon Cadastre package because it uses
the MemoryContext.
The tracing settings optionally enable Informix's tracing support
within the jdbc driver. Note, for this to work, the
ifxjdbc-g.jar and ifxjdbcx-g.jar jar files are
required (the options have no effect when using the non -g jar files).
jdbc tracing enables general logging information about the driver itself. sqli tracing enables logging of native sqli messages sent between the jdbc driver and the database server.
The attribute file specifies where to write tracing information
to, and level specifies the tracing level to be used, as
documented in the Informix JDBC programmers guide.
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
INIT_FACTORY |
private boolean |
m_autocommit |
private javax.sql.DataSource |
m_dataSource |
ROLE| Constructor and Description |
|---|
InformixDataSource()
Set up the system property for the context factory if it hasn't been
done already.
|
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
Set up the Informix driver for direct use.
|
private void |
configureTracing(org.apache.avalon.framework.configuration.Configuration config)
Helper method to enable tracing support in the Informix driver.
|
java.sql.Connection |
getConnection()
Return an Informix Connection object
|
private java.lang.Object |
getInstance(java.lang.String className) |
private void |
setProperty(java.lang.Object obj,
java.lang.String propertyName,
java.lang.Object value) |
private javax.sql.DataSource m_dataSource
private boolean m_autocommit
private static boolean INIT_FACTORY
public InformixDataSource()
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface DataSourceComponentNoValidConnectionException - when there is no valid Connection wrapper
available in the classloader.NoAvailableConnectionException - when there are no more available
Connections in the pool.java.sql.SQLExceptionpublic void configure(org.apache.avalon.framework.configuration.Configuration conf)
throws org.apache.avalon.framework.configuration.ConfigurationException
configure in interface org.apache.avalon.framework.configuration.Configurableorg.apache.avalon.framework.configuration.ConfigurationExceptionprivate void configureTracing(org.apache.avalon.framework.configuration.Configuration config)
throws org.apache.avalon.framework.configuration.ConfigurationException
config - a Configuration valueorg.apache.avalon.framework.configuration.ConfigurationException - if an error occursprivate java.lang.Object getInstance(java.lang.String className)
throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationExceptionprivate void setProperty(java.lang.Object obj,
java.lang.String propertyName,
java.lang.Object value)
throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException