Hello,
I am running up against a class cast exception in the
JDBCConnectionFactory class of excalibur
org.apache.avalon.excalibur.datasource.JdbcConnectionFactory
The exception occurs in the newInstance method where it
attempts to call the constructor class of my ovveride
connection class. The call is cast to an
AbstractJdbcConnection.
I resolved the issue with the code below as a replacement for
the method. Basically, I relied on the DeviceDriver to return
a java.sql.Connection implementation, and passed that into a
construction call for the JdbcConnection in excalibur. This
works great with Oracle 8.1.7, using the 9i Classes12.jar
driver. I have not tested it with any other versions of
Oracle or any other databases, but intend to do so.
Thanks,
Robb
public Object newInstance() throws Exception
{
AbstractJdbcConnection jdbcConnection = null;
Connection l_conn = null;
try {
if( null == m_username )
l_conn = DriverManager.getConnection( m_dburl );
else
l_conn = DriverManager.getConnection( m_dburl,
m_username, m_password );
jdbcConnection = new JdbcConnection(l_conn,
this.m_keepAlive);
} catch( Exception e ) {
try
{
if( null == m_username )
l_conn = DriverManager.getConnection( m_dburl );
else
l_conn = DriverManager.getConnection( m_dburl,
m_username, m_password );
// Support the deprecated connection constructor as
well.
boolean oracleKeepAlive = ( m_keepAlive != null ) &&
m_keepAlive.equalsIgnoreCase(
JdbcConnectionFactory.ORACLE_KEEPALIVE );
jdbcConnection = new JdbcConnection(l_conn,
this.m_keepAlive);
} catch( Exception ie ) {
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "Exception in
JdbcConnectionFactory.newInstance:", ie );
}
throw new NoValidConnectionException( ie.getMessage
() );
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>