This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 68ae6d025eb [branch-2.1][improvement](jdbc catalog) Print more errors 
when Jdbc Catalog fails to obtain a connection on FE (#41769)
68ae6d025eb is described below

commit 68ae6d025eb0f8ff75a93aa976ee7e8f89eff5c7
Author: zy-kkk <[email protected]>
AuthorDate: Sat Oct 12 21:21:54 2024 +0800

    [branch-2.1][improvement](jdbc catalog) Print more errors when Jdbc Catalog 
fails to obtain a connection on FE (#41769)
---
 .../apache/doris/datasource/jdbc/client/JdbcClient.java   |  5 +++--
 .../doris/datasource/jdbc/client/JdbcClientException.java | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
index 0e57f989df3..eccfbe7ae8e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
@@ -175,8 +175,9 @@ public abstract class JdbcClient {
             Thread.currentThread().setContextClassLoader(this.classLoader);
             conn = dataSource.getConnection();
         } catch (Exception e) {
-            String errorMessage = String.format("Can not connect to jdbc due 
to error: %s, Catalog name: %s",
-                    e.getMessage(), this.getCatalogName());
+            String errorMessage = String.format(
+                    "Catalog `%s` can not connect to jdbc due to error: %s",
+                    this.getCatalogName(), 
JdbcClientException.getAllExceptionMessages(e));
             throw new JdbcClientException(errorMessage, e);
         } finally {
             Thread.currentThread().setContextClassLoader(oldClassLoader);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientException.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientException.java
index 7fcea7aa61a..b07662459da 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientException.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientException.java
@@ -48,4 +48,19 @@ public class JdbcClientException extends RuntimeException {
         }
         return escapedArgs;
     }
+
+    public static String getAllExceptionMessages(Throwable throwable) {
+        StringBuilder sb = new StringBuilder();
+        while (throwable != null) {
+            String message = throwable.getMessage();
+            if (message != null && !message.isEmpty()) {
+                if (sb.length() > 0) {
+                    sb.append(" | Caused by: ");
+                }
+                sb.append(message);
+            }
+            throwable = throwable.getCause();
+        }
+        return sb.toString();
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to