I have a large application using Hibernate and one particular record throws the following MySQL error when hibernate tries to retrieve it:
Code:
Unknown character set index for field '25432' received from server.
at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:1664)
at com.mysql.jdbc.Field.(Field.java:144)
at com.mysql.jdbc.MysqlIO.unpackField(MysqlIO.java:506)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:280)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1319)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1218)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2233)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2193)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2174)
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:536)
I turned on SQL debugging and the SQL statement being run is over a thousand lines long and returns over 20,000 results. I assume that one of the results has an invalid character encoding (something besides Unicode or latin1). The trouble is that I don't know which record or even which table. The query joins over 20 different tables. In my production instance, I can readily reproduce this error by running a specific report on a specific product. If I run the same report on any other product, no error occurs, so I think that I can assume that there is bad data for this particular product. The trouble is that I don't have any idea about how to find the bad data.
Does anyone have any suggestions about how I could locate the source of the problem?