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 2022/11/18 08:18:45 UTC

[GitHub] [shardingsphere] zhang-zhipeng opened a new issue, #22257: shardingsphere5.2.1,encrypt、procedure,Unknown exception

zhang-zhipeng opened a new issue, #22257:
URL: https://github.com/apache/shardingsphere/issues/22257

   ### Which version of ShardingSphere did you use?
   shardingsphere-jdbc-core-spring-boot-starter 5.2.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   Caused by: java.sql.SQLException: Unknown exception: org.apache.shardingsphere.encrypt.rule.EncryptRule cannot be cast to org.apache.shardingsphere.infra.merge.engine.decorator.impl.TransparentRule
   	at org.apache.shardingsphere.infra.util.exception.external.sql.ShardingSphereSQLException.toSQLException(ShardingSphereSQLException.java:54)
   	at org.apache.shardingsphere.dialect.SQLExceptionTransformEngine.toSQLException(SQLExceptionTransformEngine.java:62)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeQuery$original$1NMIVzLb(ShardingSphereStatement.java:179)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeQuery$original$1NMIVzLb$accessor$JdNBaTmA(ShardingSphereStatement.java)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement$auxiliary$2rUx4N8I.call(Unknown Source)
   	at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeQuery(ShardingSphereStatement.java)
   	at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:439)
   	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
   	... 92 common frames omitted
   ### Actual behavior
   An error is reported when executing the stored procedure with the encryption function
   ### Reason analyze (If you can)
   procedure、encrypt。There are compatibility problems
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   create procedure p6(in month int)
   begin
        declare result varchar(10);
        case 
            when month >= 1 and month <= 3 then
                 set result := 'a';
            when month >=4 and month <= 6 then
                 set result := 'b';
            when month >= 7 and month <= 9 then
                 set result := 'c';
            when month >=10 and month <= 12 then
                 set result := 'd';
            else
                 set result := 'e';
       end case;
       select result;
   end;
   
   jdbcTemplate.queryForList("call p6(6)", String.class);
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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-unsubscribe@shardingsphere.apache.org.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322957147

   @strongduanmu It does not contain, but the original project used procedure that needed to be functional。


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] strongduanmu commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322939526

   @zhang-zhipeng What is the relationship between procedure and encrypt table? I don't see the encrypt table included in the procedure.


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322971732

   OKay


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322963425

   @strongduanmu  yes. Will it be fixed in the latest version?


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322869853

   Can I use this function in the upcoming version


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] strongduanmu commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322971285

   I will fix this bug in master branch, you can try to test it.


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] strongduanmu commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322958727

   I have reproduce this bug with following sql:
   
   ```sql
   mysql> delimiter //
   mysql> create procedure p6(in month int)
       -> begin
       -> declare result varchar(10);
       -> case
       -> when month >= 1 and month <= 3 then
       -> set result := 'a';
       -> when month >=4 and month <= 6 then
       -> set result := 'b';
       -> when month >= 7 and month <= 9 then
       -> set result := 'c';
       -> when month >=10 and month <= 12 then
       -> set result := 'd';
       -> else
       -> set result := 'e';
       -> end case;
       -> select result;
       -> end //
   Query OK, 0 rows affected (0.07 sec)
   
   mysql> delimiter ;
   
   mysql> call p6(6);
   ERROR 30000 (HY000): Unknown exception: org.apache.shardingsphere.encrypt.rule.EncryptRule cannot be cast to org.apache.shardingsphere.infra.merge.engine.decorator.impl.TransparentRule
   ```


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1323108949

   @strongduanmu  All right now.


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] strongduanmu commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322984993

   Hi @zhang-zhipeng, can you help test this bug with latest master branch?


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] strongduanmu commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322873293

   @zhang-zhipeng I will check this exception as soon as possible.


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1321134213

   rules:
         encrypt:
           encryptors:
             pwd-encryptor-aes: # AES加密算法
               type: AES #可逆
               props:
                 aes-key-value: 12306abc
             pwd-encryptor-md5: # MD5加密算法
               type: md5 #不可逆
             pwd-encryptor-rc4: # RC4加密算法
               type: rc4 # 可逆
               props:
                 rc4-key-value: 12306abc
             pwd-encryptor-sm3: # SM3加密算法
               type: sm3 # 不可逆
             pwd-encryptor-sm4: # SM4加密算法
               type: sm4 # 可逆
               props:
                 sm4-mode: ECB
                 sm4-padding: PKCS5Padding
                 sm4-key: 30313233343536373839616263646566l #16进制long型
   #          pwd-encryptor-custom: # 自定义算法
   #            type: custom # 可逆
   #            props:
   #              custom-key-value: 12306abc
           tables:
             t_cipher_old: # 需要加密的表名
               columns:
                 pwd: # 逻辑列名
                   #plainColumn: pwd # 明文列名
                   cipherColumn: pwd_cipher # 密文列名
                   encryptorName: pwd-encryptor-aes # 配置该密文字段的加密算法,配置于spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor-aes
                   #assistedQueryColumn: pwd_assisted_query
                   #assistedQueryEncryptorName: pwd-encryptor-md5
                 mobile: # 逻辑列名
                   #plainColumn: mobile # 明文列名
                   cipherColumn: mobile_cipher # 密文列名
                   encryptorName: pwd-encryptor-aes # 配置该密文字段的加密算法,配置于spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor-aes
                   #assistedQueryColumn: pwd_assisted_query
                   #assistedQueryEncryptorName: pwd-encryptor-md5
               queryWithCipherColumn: true # 是否使用密文字段查询 true:是, false 使用明文字段查询
             t_cipher_old2: # 需要加密的表名
               columns:
                 pwd: # 逻辑列名
                   #plainColumn: pwd # 明文列名
                   cipherColumn: pwd_cipher # 密文列名
                   encryptorName: pwd-encryptor-aes # 配置该密文字段的加密算法,配置于spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor-aes
                   #assistedQueryColumn: pwd_assisted_query
                   #assistedQueryEncryptorName: pwd-encryptor-md5
                 mobile: # 逻辑列名
                   #plainColumn: mobile # 明文列名
                   cipherColumn: mobile_cipher # 密文列名
                   encryptorName: pwd-encryptor-aes # 配置该密文字段的加密算法,配置于spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor-aes
                   #assistedQueryColumn: pwd_assisted_query
                   #assistedQueryEncryptorName: pwd-encryptor-md5
               queryWithCipherColumn: true # 是否使用密文字段查询 true:是, false 使用明文字段查询


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1321134966

   init sql:
   CREATE TABLE `t_cipher_old` (
     `id` bigint(20) NOT NULL,
     `name` varchar(255) DEFAULT NULL,
     `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     `mobile` varchar(100) DEFAULT NULL,
     `pwd_cipher` varchar(100) DEFAULT NULL,
     `customer_id` varchar(100) DEFAULT NULL,
     `pwd_assisted_query` varchar(100) DEFAULT NULL,
     `mobile_cipher` varchar(100) DEFAULT NULL,
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   CREATE TABLE `t_cipher_old2` (
     `id` bigint(20) NOT NULL,
     `name` varchar(255) DEFAULT NULL,
     `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     `mobile` varchar(100) DEFAULT NULL,
     `pwd_cipher` varchar(100) DEFAULT NULL,
     `customer_id` varchar(100) DEFAULT NULL,
     `pwd_assisted_query` varchar(100) DEFAULT NULL,
     `mobile_cipher` varchar(100) DEFAULT NULL,
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] taojintianxia closed issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
taojintianxia closed issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported
URL: https://github.com/apache/shardingsphere/issues/22257


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1322884237

   thank you


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1321088208

   shardingsphere5.2.1,Using encrypt,SQL contains procedure ,an error will be reported


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhang-zhipeng commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
zhang-zhipeng commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1321089165

   How can I solve this problem


-- 
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-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] strongduanmu commented on issue #22257: When I use the encryption function, if the executed SQL fragment contains procedure, an error will be reported

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22257:
URL: https://github.com/apache/shardingsphere/issues/22257#issuecomment-1321112517

   Hi @zhang-zhipeng, can you provide your encrypt rule?


-- 
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-unsubscribe@shardingsphere.apache.org

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