mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-29 18:53:12 +08:00
当数据库为hive时,查看schema时将url设置成空
This commit is contained in:
@ -80,9 +80,13 @@ public class DatabaseServiceImpl implements DatabaseService {
|
|||||||
if (CollectionUtils.isEmpty(schemas)) {
|
if (CollectionUtils.isEmpty(schemas)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String ulr = null;
|
String url = null;
|
||||||
try {
|
try {
|
||||||
ulr = connection.getMetaData().getURL();
|
if (connection.getMetaData().getClass().getName().contains("HiveDatabaseMetaData")) {
|
||||||
|
url = "";
|
||||||
|
} else {
|
||||||
|
url = connection.getMetaData().getURL();
|
||||||
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("get url error", e);
|
log.error("get url error", e);
|
||||||
}
|
}
|
||||||
@ -90,7 +94,7 @@ public class DatabaseServiceImpl implements DatabaseService {
|
|||||||
int num = -1;
|
int num = -1;
|
||||||
for (int i = 0; i < schemas.size(); i++) {
|
for (int i = 0; i < schemas.size(); i++) {
|
||||||
String schema = schemas.get(i).getName();
|
String schema = schemas.get(i).getName();
|
||||||
if (StringUtils.isNotBlank(ulr) && schema!=null && ulr.contains(schema)) {
|
if (StringUtils.isNotBlank(url) && schema!=null && url.contains(schema)) {
|
||||||
num = i;
|
num = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user