jzs1997 opened a new issue, #34925:
URL: https://github.com/apache/shardingsphere/issues/34925

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   Compiled from source code, without any modification
   openGauss version: 7.0.0 compiled from latest source code
   openGauss-JDBC-driver version: opengauss-jdbc-6.0.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Connection Built Successfully 
   
   ### Actual behavior
   
   Failed to build connection
   
   
   When I tried to connect to shardingsphere via openGauss-jdbc-driver, I got 
this error:
   
   ```
   Exception in thread "main" org.opengauss.util.PSQLException: Something 
unusual has occured to cause the driver to fail. Please report this exception.
        at org.opengauss.Driver.connect(Driver.java:337)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
        at Test1.buildConnection(Test1.java:13)
        at Test1.<init>(Test1.java:8)
        at Main.main(Main.java:6)
   Caused by: java.lang.IllegalArgumentException: No enum constant 
org.opengauss.util.CompatibilityEnum.
        at java.base/java.lang.Enum.valueOf(Enum.java:240)
        at 
org.opengauss.util.CompatibilityEnum.valueOf(CompatibilityEnum.java:3)
        at org.opengauss.jdbc.PgDatabase.setDolphin(PgDatabase.java:48)
        at org.opengauss.jdbc.PgConnection.<init>(PgConnection.java:332)
        at org.opengauss.Driver.makeConnection(Driver.java:568)
        at org.opengauss.Driver.connect(Driver.java:317)
        ... 5 more
   ```
   Basically dolphin is an extension of openGauss which is not installed by 
default. And in openGauss-jdbc-driver, it will decide where to use dolphin:
   ```
   public class PgDatabase {
       private PgConnection connection;
       private boolean isDolphin;
       private boolean isDec;
   
       public PgDatabase(PgConnection connection) {
           this.connection = connection;
       }
   
       public boolean isDolphin() {
           return this.isDolphin;
       }
   
       public boolean isDec() {
           return this.isDec;
       }
   
       public void setDolphin(Properties info) throws SQLException {
           String extensionDolphin = this.getDolphin("select count(1) from 
pg_extension where extname = 'dolphin';");
           int dolphinNum = Integer.parseInt(extensionDolphin);
           String compatibility = this.getDolphin("show 
dolphin.b_compatibility_mode;");
           CompatibilityEnum compatibilityEnum = 
CompatibilityEnum.valueOf(compatibility.toUpperCase(Locale.ROOT));
           if (dolphinNum > 0 && 
CompatibilityEnum.ON.equals(compatibilityEnum)) {
               this.isDolphin = true;
               String bitOutput = PGProperty.BIT_OUTPUT.get(info);
               if (bitOutput == null) {
                   bitOutput = this.getDolphin("show dolphin.bit_output;");
               } else {
                   this.updateBitOutput(bitOutput);
               }
   
               if 
(BitOutputEnum.DEC.equals(BitOutputEnum.valueOf(bitOutput.toUpperCase(Locale.ROOT))))
 {
                   this.isDec = true;
               }
           } else {
               this.isDolphin = false;
           }
   
       }
   ```
   Basically, if the `dolphinNum` larger than 0 it will think it needs to set 
dolphin, but I do not have dolphin which means `select count(1) from 
pg_extension where extname = 'dolphin';` will return 0 and I checked this in my 
database and shardingsphere and the values returned are all 0. 
   
   
![Image](https://github.com/user-attachments/assets/c53e0ecb-794b-438a-8a3c-c61ede158c9c)
   
   
![Image](https://github.com/user-attachments/assets/48929fa1-cea1-4ee9-89e0-736687074314)
   
   I am new to this. I tried to debug tthis but got pretty confused. Hope that 
I could at least got some hint on which module I should check. 
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
notifications-unsubscr...@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to