public PluginDao(final DataSource dataSource, final SQLDialect dialect) throws SQLException { this.dataSource = dataSource; this.dialect = dialect; switch (dialect) { case H2: final String schema; Connection connection = null; try { connection = dataSource.getConnection(); schema = connection.getSchema(); } finally { if (connection != null) { connection.close(); } } final MappedSchema mappedSchema = new MappedSchema().withInput(DEFAULT_SCHEMA_NAME) // As defined by the jOOQ codegen .withOutput(schema); final RenderMapping renderMapping = new RenderMapping().withSchemata(mappedSchema); this.settings = new Settings().withRenderMapping(renderMapping) .withRenderNameStyle(RenderNameStyle.UPPER); break; default: // For MySQL, schema doesn't matter. // For PostgreSQL, assume schema is part of the JDBC url this.settings = new Settings().withRenderSchema(false); break; } }