Skip to content

Commit

Permalink
Merge pull request wso2#5525 from sadilchamishka/db2-issue
Browse files Browse the repository at this point in the history
Fix db2 issue
  • Loading branch information
sadilchamishka authored Feb 19, 2024
2 parents 6e10788 + 0a263ba commit bfa9848
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.sql.SQLException;
import javax.sql.DataSource;

import static org.wso2.carbon.identity.core.util.IdentityCoreConstants.DB2;

/**
* Utility class for database operations.
*/
Expand Down Expand Up @@ -205,6 +207,9 @@ public static boolean isTableExists(String tableName) {
if (metaData.storesLowerCaseIdentifiers()) {
tableName = tableName.toLowerCase();
}
if (connection.getMetaData().getDatabaseProductName().toUpperCase().contains(DB2)) {
return connection.getMetaData().getTables(null, null, tableName, new String[]{"TABLE"}).next();
}
String schemaName = connection.getSchema();
String catalogName = connection.getCatalog();
try (ResultSet resultSet = metaData.getTables(catalogName, schemaName, tableName, new String[]{"TABLE"})) {
Expand Down

0 comments on commit bfa9848

Please sign in to comment.