private void investigateDialect() {
        Connection connection = null;

        if (database == null) {
            // no database dialect from configuration guessing from MetaData
            try {
                connection = dataSource.getConnection();
                DatabaseMetaData metaData = connection.getMetaData();
                String dbProduct = metaData.getDatabaseProductName();
                database = identifyDialect(dbProduct);

                if (database == null) {
                    EjbLogger.EJB3_TIMER_LOGGER.debug("Attempting to guess on driver name.");
                    database = identifyDialect(metaData.getDriverName());
                }
            } catch (Exception e) {
                EjbLogger.EJB3_TIMER_LOGGER.debug("Unable to read JDBC metadata.", e);
            } finally {
                safeClose(connection);
            }
            if (database == null) {
                EjbLogger.EJB3_TIMER_LOGGER.jdbcDatabaseDialectDetectionFailed(databaseDialects.toString());
            } else {
                EjbLogger.EJB3_TIMER_LOGGER.debugf("Detect database dialect as '%s'.  If this is incorrect, please specify the correct dialect using the 'database' attribute in your configuration.  Supported database dialect strings are %s", database, databaseDialects);
            }
        } else {
            EjbLogger.EJB3_TIMER_LOGGER.debugf("Database dialect '%s' read from configuration, adjusting it to match the final database valid value.", database);
            database = identifyDialect(database);
            EjbLogger.EJB3_TIMER_LOGGER.debugf("New Database dialect is '%s'.", database);
        }
    }
private void investigateDialect() {
        Connection connection = null;

        if (database == null) {
            
            try {
                connection = dataSource.getConnection();
                DatabaseMetaData metaData = connection.getMetaData();
                String dbProduct = metaData.getDatabaseProductName();
                database = identifyDialect(dbProduct);

                if (database == null) {
                    EjbLogger.EJB3_TIMER_LOGGER.debug("Attempting to guess on driver name.");
                    database = identifyDialect(metaData.getDriverName());
                }
            } catch (Exception e) {
                EjbLogger.EJB3_TIMER_LOGGER.debug("Unable to read JDBC metadata.", e);
            } finally {
                safeClose(connection);
            }
            if (database == null) {
                EjbLogger.EJB3_TIMER_LOGGER.jdbcDatabaseDialectDetectionFailed(databaseDialects.toString());
            } else {
                EjbLogger.EJB3_TIMER_LOGGER.debugf("Detect database dialect as '%s'.  If this is incorrect, please specify the correct dialect using the 'database' attribute in your configuration.  Supported database dialect strings are %s", database, databaseDialects);
            }
        } else {
            EjbLogger.EJB3_TIMER_LOGGER.debugf("Database dialect '%s' read from configuration, adjusting it to match the final database valid value.", database);
            database = identifyDialect(database);
            EjbLogger.EJB3_TIMER_LOGGER.debugf("New Database dialect is '%s'.", database);
        }
    }
private void investigateDialect ( ) { Connection connection = null ; if ( database == null ) { // no database dialect from configuration guessing from MetaData try { connection = dataSource . getConnection ( ) ; DatabaseMetaData metaData = connection . getMetaData ( ) ; String dbProduct = metaData . getDatabaseProductName ( ) ; database = identifyDialect ( dbProduct ) ; if ( database == null ) { EjbLogger . EJB3_TIMER_LOGGER . debug ( "Attempting to guess on driver name." ) ; database = identifyDialect ( metaData . getDriverName ( ) ) ; } } catch ( Exception e ) { EjbLogger . EJB3_TIMER_LOGGER . debug ( "Unable to read JDBC metadata." , e ) ; } finally { safeClose ( connection ) ; } if ( database == null ) { EjbLogger . EJB3_TIMER_LOGGER . jdbcDatabaseDialectDetectionFailed ( databaseDialects . toString ( ) ) ; } else { EjbLogger . EJB3_TIMER_LOGGER . debugf ( "Detect database dialect as '%s'.  If this is incorrect, please specify the correct dialect using the 'database' attribute in your configuration.  Supported database dialect strings are %s" , database , databaseDialects ) ; } } else { EjbLogger . EJB3_TIMER_LOGGER . debugf ( "Database dialect '%s' read from configuration, adjusting it to match the final database valid value." , database ) ; database = identifyDialect ( database ) ; EjbLogger . EJB3_TIMER_LOGGER . debugf ( "New Database dialect is '%s'." , database ) ; } }
Check the connection MetaData and driver name to guess which database dialect
to use.
Check the connection MetaData and driver name to guess which database dialect to use .