Ooops, I suppose I should give a complete method... sorry, 
error in cut and paste.

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
() );
      }
   }

   jdbcConnection.enableLogging( getLogger() );

   // Not all drivers are friendly to explicitly setting 
autocommit
   if( jdbcConnection.getAutoCommit() != m_autoCommit ) {
      jdbcConnection.setAutoCommit( m_autoCommit );
   }

   if( getLogger().isDebugEnabled() ) {
      getLogger().debug( "JdbcConnection object created" );
   }

   return jdbcConnection;
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to