Re: MySQL >5.0.18 and Connector/J 5.0.4 weirdness
"Christopher G. Stach II" <[email protected]>
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <[email protected]> |
Christopher G. Stach II wrote: > I wish that I had more information than I currently do, but here goes: > > We're using Hibernate 3.2.0GA, and we noticed that certain classes > "can't be instantiated" from the database. Hibernate uses a CASE > statement to determine which polymorphic class to instantiate. The > concrete class' value is 4 and the abstract class' value is 2. This > works most of the time; however, on MySQL server versions >5.0.18, > regardless of whether it's Connector/J 5.0.3 or 5.0.4, it keeps picking > 2 instead of 4. Running the SQL manually always works correctly. > > I've been debugging this for a while, and the ResultSet definitely has 2 > in rowData/thisRow. The metadata seems to be working because it finds > the correct columnIndex based on the correct name. Sometimes the row > will be selected correctly, and sometimes it won't. This led me to > believe that it was caching in the driver. I have disabled all of the > driver caching (I think), but nothing changed. > Okay, this is somewhat figured out. We use Resin 3.0.19 and it doesn't seem to want to set the properties on the MysqlXADataSource with init-param, which should call the setters. It doesn't. Since that wasn't working, I decided to use the "url" tag in resin.conf. It sets that just fine, but it seems that no matter what you put in the URL, it is overridden every time. According to NonRegisteringDriver.parseURL:613, "Properties passed in should override ones in URL". This bit of code overrides everything, every time. It's not acting like "defaults", but more like "overrides". I set things on the URL, the changes appear, but it set them right back to their defaults. That's not very intuitive, and probably a bug. Anyway, I couldn't set anything with the URL or the init-params. I just added a breakpoint and manually changed "traceProtocol" and "detectServerPreparedStmts" (aka "useServerPrepStmts") to true. Voila! Things again work as expected. The packets that the driver is getting definitely have the value "2" in them. Either the server is wrong (probably), or there's some protocol mismatch. You decide. -- Christopher G. Stach II -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/[email protected]