Tuesday, August 11, 2020

MyBatis and CockroachDB

Several months ago, the team at Cockroach Labs reached out to the MyBatis developers asking if we could talk about officially supporting CockroachDB. CockroachDB is wire compatible with PostgreSQL and CockroachDB clients use the PostgreSQL JDBC driver to connect. The team at Cockroach Labs assumed that making changes in MyBatis to support CockroachDB would be relatively easy.

We had a few conversations and it turns out that we didn't need to make any changes in MyBatis to support CockroachDB. I think this is a great validation of the MyBatis approach to database dialects - we don't have one! MyBatis is able to execute SQL against any database that has a JDBC driver. We leave it fully in the hands of developers to write whatever SQL they need for the target database.

So our work with Cockroach Labs shifted to focus on documentation and examples. Today I'm happy to say that MyBatis has a page on the official Cockroach Labs documentation site here: https://www.cockroachlabs.com/docs/v20.1/build-a-spring-app-with-cockroachdb-mybatis.html

That page shows how to use the MyBatis Spring support to easily work with databases and it's a great example of how far these tools have come. There's no XML anywhere to be found - either for Spring or MyBatis.

You can also read a blog post from Cockroach labs here: https://www.cockroachlabs.com/blog/spring-data-access-tutorials/

I really want to thank the team at Cockroach Labs for helping us get to this point - especially Eric Harmeling, Vy Ton, and Andy Woods who have been great working partners.

No comments:

Post a Comment