You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/05 00:56:16 UTC

[GitHub] [shardingsphere] lvye351 commented on issue #5421: The keyGenerator doesn't work in transaction-2pc-xa-raw-jdbc-example module when a oracle database used

lvye351 commented on issue #5421:
URL: https://github.com/apache/shardingsphere/issues/5421#issuecomment-623785043


   > when configuration is as follows(actual table name use uppercase words), the issue above will absent,
   > 
   > ```
   > shardingRule:
   >   tables:
   >     t_order:
   >       actualDataNodes: ds_${0..1}.T_ORDER_${0..1}
   >       tableStrategy: 
   >         standard:
   >           shardingColumn: order_id
   >           shardingAlgorithm:
   >             type: INLINE
   >             props:
   >               algorithm.expression: T_ORDER_${order_id % 2}
   >       keyGenerator:
   >         type: SNOWFLAKE
   >         column: order_id
   >         props:
   >           worker.id: 123
   > ```
   > 
   > But when TableMetaDataLoader#isTableExist return true, there is another error occur from ColumnMetaDataLoader#load.
   > Java code is
   > 
   > ```java
   >         try (ResultSet resultSet = connection.createStatement().executeQuery(generateEmptyResultSQL(table, databaseType))) {
   >             for (String each : columnNames) {
   >                 isCaseSensitives.add(resultSet.getMetaData().isCaseSensitive(resultSet.findColumn(each)));
   >             }
   >         }
   > ```
   > 
   > Exception cause is
   > 
   > ```
   > Error : 933, Position : 38, Sql = SELECT * FROM "T_ORDER_0" WHERE 1 != 1;, OriginalSql = SELECT * FROM "T_ORDER_0" WHERE 1 != 1;, Error Msg = ORA-00933: SQL 命令未正确结束
   > ```
   > 
   > And this sql can execute successfully in PL/SQL.
   
    before  I have  found  that  ,SELECT * FROM "T_ORDER_0" WHERE 1 != 1;   the ; in the end is not allowed int oracle grammar,I  commented it in code temporarily ,   key still not  generated,  so  this is  only one bug in ColumnMetaDataLoader.generateEmptyResultSQL


----------------------------------------------------------------
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.

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