We are migrating our java based application from oracle to mariadb. With mariadb 10.5.9, we are using hibernate-5. When our application is running, we are observing in the maxscale query filter, that too many select database queries are getting called. Without maxscale and with the plain mariadb we don't see this issue. We were using mariadb-java-client-2.6.0.jar, but we are seeing issue even with the latest driver (2.7.2).
tcpdump shows prepared statements are not used, statements are getting constructed every time. So I assume with maxscale select database is called while constructing the statement.
So used:
Case 1: db.url=jdbc:mariadb://{host}:{port}/dbname?user=username&password=password?useServerPrepStmts=true
Case 2: db.url=jdbc:mariadb://{host}:{port}/dbname?user=username&password=password?useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=500&prepStmtCacheSqlLimit=1024
Still in both the cases, I see plain statements used and also select database query getting called frequently.
Please share your thoughts.
As was mentioned in the comments, this was a bug caused by MXS-3533. You can fix this problem by upgrading to MaxScale 2.5.13 or newer.