Where answers come from

Some pages can ask a language model questions. Set this up once; your choice is remembered in this browser for the whole site.

Model source
Use another source instead
You sign in on OpenRouter; it gives this page a key for your account.

Magical MySQL URL parameters Save my Groovy Code

Originally published .

I’ve been working with legacy databases in MySQL and basically forbidden from using hibernate by a bug I had with all zero dates of the format ‘0000-00-00’ which is perfectly legal in MySQL but completely disallowed in JDBC.

Stack trace for this problem contains:


SQL Exception: Value '0000-00-00' can not be represented as java.sql.Date

The answer? Apparently there is a hidden setting to use…


dataSource {

  driverClassName = "com.mysql.jdbc.Driver"

  dialect= org.hibernate.dialect.MySQLMyISAMDialect

  url = "jdbc:mysql://localhost:3306/legacy?zeroDateTimeBehavior=convertToNull"

  username = "legacyUser"

  password = "legacyPassword"

 }

That little flag on the URL is absolutely magical and now I can map my Grails objects onto a legacy database. Isn’t life grand?

Explore the map · Browse by topic and date