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

deepak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6bef4c2fba Use connection.getCatalog()to include the catalog from the 
Connection; this is needed for MySQL which does not restrict meta data queries 
to the current connected database without specifying a catalog on these 
methods, may cause issues with other databases and needs more testing (#543)
6bef4c2fba is described below

commit 6bef4c2fbad4e5c293ae99b7acc056bb40386452
Author: Deepak Dixit <dee...@apache.org>
AuthorDate: Mon Sep 19 13:30:55 2022 +0530

    Use connection.getCatalog()to include the catalog from the Connection; this 
is needed for MySQL which does not restrict meta data queries to the current 
connected database without specifying a catalog on these methods, may cause 
issues with other databases and needs more testing (#543)
---
 .../src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java 
b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
index b64c8cc3b5..d166a892b0 100644
--- 
a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
+++ 
b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
@@ -1019,7 +1019,7 @@ public class DatabaseUtil {
         try {
             String[] types = {"TABLE", "BASE TABLE", "VIEW", "ALIAS", 
"SYNONYM"};
             lookupSchemaName = getSchemaName(dbData);
-            tableSet = dbData.getTables(null, lookupSchemaName, null, types);
+            tableSet = dbData.getTables(connection.getCatalog(), 
lookupSchemaName, null, types);
             if (tableSet == null) {
                 Debug.logWarning("getTables returned null set", MODULE);
             }
@@ -1158,7 +1158,7 @@ public class DatabaseUtil {
                 }
 
                 boolean foundCols = false;
-                ResultSet rsCols = dbData.getColumns(null, lookupSchemaName, 
null, null);
+                ResultSet rsCols = dbData.getColumns(connection.getCatalog(), 
lookupSchemaName, null, null);
                 if (!rsCols.next()) {
                     try {
                         rsCols.close();
@@ -1167,7 +1167,7 @@ public class DatabaseUtil {
                         Debug.logError(message, MODULE);
                         if (messages != null) messages.add(message);
                     }
-                    rsCols = dbData.getColumns(null, lookupSchemaName, "%", 
"%");
+                    rsCols = dbData.getColumns(connection.getCatalog(), 
lookupSchemaName, "%", "%");
                     if (!rsCols.next()) {
                         Debug.logVerbose("Now what to do? I guess try one 
table name at a time...", MODULE);
                     } else {

Reply via email to