In Play Problem with MariaDB JDBC Driver Client org.mariadb.jdbc.Driver

My latest Play problem was actually a jdbc driver bug.

With all the fixing (and learning) I’ve been doing the last few days trying to get the hang of ebeans in Play 2.4.x, the last thing I expected was one of my biggest hangups to be a jdbc bug.  As anyone who has been here knows, I am a huge fan of MariaDB so don’t take this to mean otherwise.  However, if using the Maria client 1.3.2 in Play with ebeans or likely with many other common ORM’s, and you get an error like:

[PersistenceException: ERROR executing DML bindLog[] error[getGeneratedKeys error. Statement.RETURN_GENERATED_KEYS must be precised on connection.prepareStatement(String sql, int autoGeneratedKeys) or statement.executeUpdate(String sql, int autoGeneratedKeys)]]

It isn’t you. It is actually a bug. A smart guy timowest pointed this out on github 10 days ago

Looks like a bug in the driver

The flag Statement.RETURN_GENERATED_KEYS is missing.

I switched to the oracle driver in application.conf and all works great.  Good find Tim!  I’ll be switching back as soon as this is resolved in the maria client binary.  I’m hoping this has been reported.

While I’m giving a shout out.  Thanks also to Matthieu Guillermin and his great post on getting around ebean optimistic locking in Play.  You can find his great post here


Leave a Reply

Your email address will not be published. Required fields are marked *