spring-data-r2dbc icon indicating copy to clipboard operation
spring-data-r2dbc copied to clipboard

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Open sysmat opened this issue 3 years ago • 6 comments
trafficstars

  • java 17
  • spring-boot-starter-parent: 2.6.4; spring-boot-starter-webflux; r2dbc-mysql
  • person record:
@Table("person")
record Person(@Id Integer id, String name, String surname) {}
  • person repository:
public interface PersonRepo extends ReactiveCrudRepository<Person, Integer>{}
  • person controller:
@GetMapping("/{id}")
private Mono<Person> findById(@PathVariable Integer id) {
        return personRepo.findById(id);
    }
  • error: Caused by: com.github.jasync.sql.db.mysql.exceptions.MySQLException: Error 1064 - #42000 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

sysmat avatar Mar 23 '22 12:03 sysmat

  • using 2 different drivers, same error:

  • com.github.jasync-sql:jasync-r2dbc-mysql:2.0.6

2022-03-24 07:21:42.623 ERROR 20852 --- [-netty-thread-1] c.g.jasync.sql.db.mysql.MySQLConnection  : <mysql-connection-1> Received an error message -> ErrorMessage(errorCode=1064, sqlState=#42000, errorMessage=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1)
2022-03-24 07:21:42.692 ERROR 20852 --- [-netty-thread-2] c.g.jasync.sql.db.mysql.MySQLConnection  : <mysql-connection-2> Received an error message -> ErrorMessage(errorCode=1064, sqlState=#42000, errorMessage=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1)

  • dev.miku:r2dbc-mysql:0.8.2.RELEASE
Caused by: io.r2dbc.spi.R2dbcBadGrammarException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
	at dev.miku.r2dbc.mysql.ExceptionFactory.createException(ExceptionFactory.java:81) ~[r2dbc-mysql-0.8.2.RELEASE.jar:0.8.2.RELEASE]

sysmat avatar Mar 24 '22 06:03 sysmat

  • I try with R2dbcRepository interface, same error

sysmat avatar Mar 24 '22 08:03 sysmat

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem.

mp911de avatar Mar 28 '22 06:03 mp911de

is there any spring property for r3dbc that will log SQL statements, like spring.jpa.show-sql?

sysmat avatar Mar 28 '22 07:03 sysmat

You can enable debug logging if you set the logger org.springframework.r2dbc.core to DEBUG.

mp911de avatar Mar 28 '22 07:03 mp911de

  • logging.level.org.springframework.r2dbc.core=DEBUG no sql in log

sysmat avatar Mar 28 '22 07:03 sysmat