public void initDatabaseType() { Connection connection = null; try { connection = dataSource.getConnection(); DatabaseMetaData databaseMetaData = connection.getMetaData(); String databaseProductName = databaseMetaData.getDatabaseProductName(); if (MY_SQL_PRODUCT_NAME.equals(databaseProductName)) { databaseProductName = checkForMariaDb(databaseMetaData, databaseProductName); } LOG.debugDatabaseproductName(databaseProductName); databaseType = databaseTypeMappings.getProperty(databaseProductName); ensureNotNull("couldn't deduct database type from database product name '" + databaseProductName + "'", "databaseType", databaseType); LOG.debugDatabaseType(databaseType); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (connection != null) { connection.close(); } } catch (SQLException e) { e.printStackTrace(); } } }
public void initDatabaseType() { Connection connection = null; try { connection = dataSource.getConnection(); DatabaseMetaData databaseMetaData = connection.getMetaData(); String databaseProductName = databaseMetaData.getDatabaseProductName(); if (MY_SQL_PRODUCT_NAME.equals(databaseProductName)) { databaseProductName = checkForMariaDb(databaseMetaData, databaseProductName); } LOG.debugDatabaseproductName(databaseProductName); databaseType = databaseTypeMappings.getProperty(databaseProductName); ensureNotNull("couldn't deduct database type from database product name '" + databaseProductName + "'", "databaseType", databaseType); LOG.debugDatabaseType(databaseType); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (connection != null) { connection.close(); } } catch (SQLException e) { e.printStackTrace(); } } }
public void initDatabaseType() { Connection connection = null; try { connection = dataSource.getConnection(); DatabaseMetaData databaseMetaData = connection.getMetaData(); String databaseProductName = databaseMetaData.getDatabaseProductName(); if (MY_SQL_PRODUCT_NAME.equals(databaseProductName)) { databaseProductName = checkForMariaDb(databaseMetaData, databaseProductName); } LOG.debugDatabaseproductName(databaseProductName); databaseType = databaseTypeMappings.getProperty(databaseProductName); ensureNotNull("couldn't deduct database type from database product name '" + databaseProductName + "'", "databaseType", databaseType); LOG.debugDatabaseType(databaseType); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (connection != null) { connection.close(); } } catch (SQLException e) { e.printStackTrace(); } } }