Skip to content

Commit

Permalink
[fix](jdbc catalog) fix be crash when create jdbc catalog without dri…
Browse files Browse the repository at this point in the history
…ver jar (apache#42948)

When creating a JDBC Catalog, a connection test is performed. However,
if the JDBC Driver path does not exist, we should report an error that
the file cannot be opened and not clean up the resources, because the
resources have not been created. Cleaning up non-existent resources will
cause the program to crash. This PR is changed to clean up only when the
resources are created.
  • Loading branch information
zy-kkk authored Oct 31, 2024
1 parent 19016b1 commit 45cdda0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions be/src/vec/exec/vjdbc_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ Status JdbcConnector::test_connection() {
}

Status JdbcConnector::clean_datasource() {
if (!_is_open) {
return Status::OK();
}
JNIEnv* env = nullptr;
RETURN_IF_ERROR(JniUtil::GetJNIEnv(&env));
env->CallNonvirtualVoidMethod(_executor_obj, _executor_clazz, _executor_clean_datasource_id);
Expand Down

0 comments on commit 45cdda0

Please sign in to comment.