[Fix][DAS] Specify the catalog and schema when check table or column exists (#6646)
* Specify the catalog and schema when check table and column exsitsrefactor-ui
parent
f20444792c
commit
900cf3a7e3
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue