m_renameRoles = "UPDATE " + m_roleTable + " SET " + m_loginName + "=? WHERE " + m_loginName + "=?";
}
catch( NamingException e )
{
log.error( "JDBCUserDatabase initialization error: " + e.getMessage() );
throw new NoRequiredPropertyException( PROP_DB_DATASOURCE, "JDBCUserDatabase initialization error: " + e.getMessage() );
}
// Test connection by doing a quickie select
Connection conn = null;
try
{
conn = m_ds.getConnection();
PreparedStatement ps = conn.prepareStatement( m_findAll );
ps.executeQuery();
ps.close();
}
catch( SQLException e )
{
log.error( "JDBCUserDatabase initialization error: " + e.getMessage() );
throw new NoRequiredPropertyException( PROP_DB_DATASOURCE, "JDBCUserDatabase initialization error: " + e.getMessage() );
}
finally
{
try
{
if( conn != null ) conn.close();
}
catch( Exception e )
{
}
}
log.info( "JDBCUserDatabase initialized from JNDI DataSource: " + jndiName );
// Determine if the datasource supports commits
try
{
conn = m_ds.getConnection();
DatabaseMetaData dmd = conn.getMetaData();
if( dmd.supportsTransactions() )
{
m_supportsCommits = true;
conn.setAutoCommit( false );
log.info( "JDBCUserDatabase supports transactions. Good; we will use them." );
}
}
catch( SQLException e )
{
log.warn( "JDBCUserDatabase warning: user database doesn't seem to support transactions. Reason: " + e.getMessage() );
throw new NoRequiredPropertyException( PROP_DB_DATASOURCE, "JDBCUserDatabase initialization error: " + e.getMessage() );
}
finally
{
try
{