/* Copyright 2015 Nationale-Nederlanden Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package nl.nn.adapterframework.jdbc.dbms; import java.sql.Connection; import nl.nn.adapterframework.jdbc.JdbcException; import nl.nn.adapterframework.util.JdbcUtil; import org.apache.commons.lang.StringUtils; /** * Support for H2. * * @author Jaco de Groot */ public class H2DbmsSupport extends GenericDbmsSupport { public int getDatabaseType() { return DbmsSupportFactory.DBMS_H2; } public String getDbmsName() { return "H2"; } public String getSchema(Connection conn) throws JdbcException { return JdbcUtil.executeStringQuery(conn, "SELECT SCHEMA()"); } public boolean isTablePresent(Connection conn, String schemaName, String tableName) throws JdbcException { return doIsTablePresent(conn, "INFORMATION_SCHEMA.TABLES", "TABLE_SCHEMA", "TABLE_NAME", schemaName, tableName.toUpperCase()); } public boolean isTableColumnPresent(Connection conn, String schemaName, String tableName, String columnName) throws JdbcException { return doIsTableColumnPresent(conn, "INFORMATION_SCHEMA.COLUMNS", "TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME", schemaName, tableName, columnName); } }