Browse Source

[Fix][DAS] Specify the catalog and schema when check table or column exists (#6646)

* Specify the catalog and schema when check table and column exsits
2.0.7-release
chouc 3 years ago committed by lenboo
parent
commit
2a623561b1
  1. 4
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/MysqlUpgradeDao.java
  2. 4
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/PostgresqlUpgradeDao.java

4
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/MysqlUpgradeDao.java

@ -60,7 +60,7 @@ public class MysqlUpgradeDao extends UpgradeDao {
Connection conn = null;
try {
conn = dataSource.getConnection();
rs = conn.getMetaData().getTables(null, null, tableName, null);
rs = conn.getMetaData().getTables(conn.getCatalog(), conn.getSchema(), tableName, null);
return rs.next();
} catch (SQLException e) {
logger.error(e.getMessage(),e);
@ -82,7 +82,7 @@ public class MysqlUpgradeDao extends UpgradeDao {
Connection conn = null;
try {
conn = dataSource.getConnection();
ResultSet rs = conn.getMetaData().getColumns(null,null,tableName,columnName);
ResultSet rs = conn.getMetaData().getColumns(conn.getCatalog(), conn.getSchema(),tableName,columnName);
return rs.next();
} catch (SQLException e) {

4
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/PostgresqlUpgradeDao.java

@ -89,7 +89,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
try {
conn = dataSource.getConnection();
rs = conn.getMetaData().getTables(null, SCHEMA, tableName, null);
rs = conn.getMetaData().getTables(conn.getCatalog(), SCHEMA, tableName, null);
return rs.next();
} catch (SQLException e) {
@ -113,7 +113,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
ResultSet rs = null;
try {
conn = dataSource.getConnection();
rs = conn.getMetaData().getColumns(null, SCHEMA,tableName,columnName);
rs = conn.getMetaData().getColumns(conn.getCatalog(), SCHEMA,tableName,columnName);
return rs.next();
} catch (SQLException e) {
logger.error(e.getMessage(),e);

Loading…
Cancel
Save