Zero dates or Null in MYSQL?

As a follow-up to my earlier post on date conversions, I noticed that the MYSQL database was getting loaded with a lot of zero dates where the original data had null dates, I wondered how to deal with this and if it would present issues… well here is a great tip: Also note that MYSQL more or less requires zero dates and does not like nulls for dates…

The following from http://hartsock.blogspot.com

Magical MySQL URL parameters Save my Groovy Code

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?

Thoughts and Ideas: Magical MySQL URL parameters Save my Groovy Code.

Advertisements

Installing Eclipse Ganymede on Win XP sp3

Eclipse looks to be a very powerful and well supported software development environment, with huge capability, if I can get it running!

Well…Since for the time being I bombed out on my Linux installation I thought I’d try the win Xp install. I chose the “Ganymede RC3” Report writer package. Every thing seemed to go very smoothly. Then I tried to get my My SQL database hooked up using the JDBC driver… At first I though I had it, the server pinged and indicated that it was connected.. But then I went to look for “data” the server it turns out should have shown up on the navigator with the various databases, so a “data source could be defined,,, These things never happened,. Left some messages on the Newsgroup. Got asked to file a bug report, I did, It’s Bug 236647 In Bugzilla. The first response has been that they tried it and everything works great… So again I’m at a dead end with even being able to get a fairly good starting point with Eclipse. What I don’t get is why it has such an extensive error log when I do a clean install.. It looks like ti is trying to install a bunch of other items not in the installed package,,, It makes getting useful error messages hard to distinguish from the noise.

It should not be this difficult to get a tool installed and working… I’ll even grant that it is probably “user error” but Still!!! Give me something to go on!!!

It’s pretty clear that I have to get this working but I’m not sure what’s next. I’ll have to give them a few days to see if Eclipse people can help me out. I have to get some real work done anyway!

When I get a chance I’ll update getting MYSQL going. I found a neat tool HeidiSQL looks to be much more complete and free than the mysql workbench.