You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "wwding (via GitHub)" <gi...@apache.org> on 2024/09/21 04:31:55 UTC

[I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

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

   
   ![image](https://github.com/user-attachments/assets/c98dfa82-df8c-496b-a219-477bdb02b0b1)
   
   SELECT * FROM (  SELECT TMP_PAGE.*, ROWNUM PAGEHELPER_ROW_ID FROM ( 
   SELECT  attendance_id,worker_Id,param,project_id,attendance_date,operation_type,update_Time AS createTime,update_Time  FROM tf_b_attendance_mirror      WHERE  (project_id = ?)
    ) TMP_PAGE) WHERE PAGEHELPER_ROW_ID <= ? AND PAGEHELPER_ROW_ID > ?
   
   
   		<dependency>
   			<groupId>org.apache.shardingsphere</groupId>
   			<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
   			<version>5.2.1</version>
   		</dependency>
   
   
   
   org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error preparing statement.  Cause: org.apache.shardingsphere.sql.parser.exception.SQLParsingException
   
   org.apache.ibatis.exceptions.PersistenceException: 
   ### Error querying database.  Cause: org.apache.ibatis.executor.ExecutorException: Error preparing statement.  Cause: org.apache.shardingsphere.sql.parser.exception.SQLParsingException
   ### The error may exist in com/example/demo/zhao/AttendanceMirrorMapper.java (best guess)
   ### The error may involve com.example.demo.zhao.AttendanceMirrorMapper.selectList
   ### The error occurred while executing a query
   ### SQL: SELECT * FROM (  SELECT TMP_PAGE.*, ROWNUM PAGEHELPER_ROW_ID FROM (  SELECT  attendance_id,worker_Id,param,project_id,attendance_date,operation_type,update_Time AS createTime,update_Time  FROM tf_b_attendance_mirror      WHERE  (project_id = ?)  ) TMP_PAGE) WHERE PAGEHELPER_ROW_ID <= ? AND PAGEHELPER_ROW_ID > ?
   ### Cause: org.apache.ibatis.executor.ExecutorException: Error preparing statement.  Cause: org.apache.shardingsphere.sql.parser.exception.SQLParsingException


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "fnwind (via GitHub)" <gi...@apache.org>.
fnwind commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-3342361850

   Although this issue has already been closed, I’d like to leave my solution here for reference in case someone else encounters the same problem.
   
   I am using `sharding-jdbc-spring-boot-starter:4.1.1`, `mybatis-plus-boot-starter:3.5.3`, and `DmJdbcDriver18:8.1.2.192`。
   
   ```xml
   <dependency>
   	<groupId>org.apache.shardingsphere</groupId>
   	<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
   	<version>4.1.1</version>
   </dependency>
   <dependency>
   	<groupId>com.baomidou</groupId>
   	<artifactId>mybatis-plus-boot-starter</artifactId>
   	<version>3.5.3</version>
   </dependency>
   <dependency>
   	<groupId>com.dameng</groupId>
   	<artifactId>DmJdbcDriver18</artifactId>
   	<version>8.1.2.192</version>
   </dependency>
   ```
   
   After reviewing other issues and the official extension implementations under [jdbc-dialect](https://github.com/apache/shardingsphere/tree/master/jdbc-dialect)
   , I am **convinced that DM8 is not supported**.
   
   In my experiments, I found that when `jdbc:dm://` cannot be matched, ShardingSphere falls back to parsing with the MySQL dialect. MySQL obviously cannot parse DM8’s pagination syntax, **but DM8 actually works fine with MySQL-style pagination syntax**.
   
   So I added a custom configuration property `xxx.mybatis.page-interceptor-db-type=mysql` to force MyBatis-Plus’s `PageInterceptor` to generate pagination SQL using the MySQL dialect:
   
   ```java
   @Data
   @ConfigurationProperties(prefix = "xxx.mybatis")
   public class MybatisProperties {
       private DbType pageInterceptorDbType;
   }
   ```
   
   ```java
   @Bean
   public MybatisPlusInterceptor mybatisPlusInterceptor(MybatisProperties mybatisProperties) {
   	MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
       // ...
   	DbType customDbType = mybatisProperties.getPageInterceptorDbType();
   	if (null != customDbType) {
   		interceptor.addInnerInterceptor(new PaginationInnerInterceptor(customDbType));
   	} else {
   		interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
   	}
   
   	return interceptor;
   }
   ```
   
   ```yaml
   spring:
     shardingsphere:
       datasource:
         names: dm8
         dm8:
           type: com.alibaba.druid.pool.DruidDataSource
           username: MY_APP
           password: PASSWORD
           driverClassName: dm.jdbc.driver.DmDriver
           url: jdbc:dm://localhost:5236
   xxx:
     mybatis:
       page-interceptor-db-type: mysql
   ```
   
   At least in my project, this setup works.


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-3342470042

   > At least in my project, this setup works.
   
   - If Dameng refuses to provide a Docker image usable in unit tests, there's little that can be done about ShardingSphere's master branch. This is completely different from the situation with MS SQL Server, where Microsoft employees have addressed the availability of Docker images for MS SQL Server in open source projects. See https://github.com/testcontainers/testcontainers-java/issues/2496#issuecomment-610402944 .
   - It is very strange that there is no reproducible unit test for the master branch of shardingsphere.


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-2365181311

   **For English only**, other languages will not accept.


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "wwding (via GitHub)" <gi...@apache.org>.
wwding commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-2365000638

   
   
   shardingsphere 5.5.0. 和 <dependency>
   
   <groupId>org.apache.shardingsphere</groupId>
   <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
   <version>5.2.1</version>
   </dependency>不兼容
   
   
   
   
   | |
   丁稳稳
   |
   |
   ***@***.***
   |
   ---- 回复的原邮件 ----
   | 发件人 | Ling ***@***.***> |
   | 发送日期 | 2024年9月21日 12:36 |
   | 收件人 | ***@***.***> |
   | 抄送人 | ***@***.***>,
   ***@***.***> |
   | 主题 | Re: [apache/shardingsphere] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 (Issue #32946) |
   You should try shardingsphere 5.5.0.
   You need to provide git with minimal reproducible unit tests, where your database should be created by testcontainers-java.
   By the way, dm8 never provided docker image or testcontainer module for developers, and I think it is impossible to solve this problem in a public environment.
   
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you authored the thread.Message ID: ***@***.***>


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "wwding (via GitHub)" <gi...@apache.org>.
wwding commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-2365001997

   好的,我尝试一下,感谢
   
   
   
   | |
   dingwenwen
   
   |
   |
   ***@***.***
   |
   ---- 回复的原邮件 ----
   | 发件人 | Ling ***@***.***> |
   | 发送日期 | 2024年9月21日 12:57 |
   | 收件人 | ***@***.***> |
   | 抄送人 | ***@***.***>,
   ***@***.***> |
   | 主题 | Re: [apache/shardingsphere] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 (Issue #32946) |
   You no longer need ShardingSphere Spring Boot Starter, it has been removed due to incompatibility with Spring Boot 3.
   By the way, you exposed your private information when you replied via email.
   
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you authored the thread.Message ID: ***@***.***>


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-2365001335

   - You no longer need ShardingSphere Spring Boot Starter, it has been removed due to incompatibility with Spring Boot 3.
   - By the way, you exposed your private information when you replied via email.


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #32946: shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错
URL: https://github.com/apache/shardingsphere/issues/32946


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


Re: [I] shardingsphere集成达梦,使用分页插件 PageHelper.startPage(1,2);报错 [shardingsphere]

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on issue #32946:
URL: https://github.com/apache/shardingsphere/issues/32946#issuecomment-2364995987

   - You should try shardingsphere 5.5.0.
   - You need to provide git with minimal reproducible unit tests, where your database should be created by testcontainers-java.
   - By the way, dm8 never provided docker image or testcontainer module for developers, and I think it is impossible to solve this problem in a public environment.


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