title: Unknown character set index for field received from server
body: <p>I have an instance of MySQL 5.0.4.1 with an application written in Hibernate. On one of the pages, I get the following error message in the server log:</p>
  
  <blockquote>
    <p>Unknown character set index for field '123' received from server.<br />at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:1664)<br />at com.mysql.jdbc.Field.(Field.java:144)<br />at com.mysql.jdbc.MysqlIO.unpackField(MysqlIO.java:506)<br />at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:280)<br />at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1319)<br />at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1218)<br />at com.mysql.jdbc.Connection.execSQL(Connection.java:2233)<br />at com.mysql.jdbc.Connection.execSQL(Connection.java:2193)<br />at com.mysql.jdbc.Connection.execSQL(Connection.java:2174)<br />at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:536)<br />at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:268)<br />at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:293)<br />at org.hibernate.transaction.JDBCTransaction.toggleAutoCommit(JDBCTransaction.java:194)<br />at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:186)<br />at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:162)<br />at org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:603)<br />at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:579)<br />at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:556)<br />at org.springframework.transaction.interceptor.TransactionAspectSupport.doCloseTransactionAfterThrowing(TransactionAspectSupport.java:284)<br />at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)<br />at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)<br />at org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)<br />at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)<br />at org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)<br />at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)<br />at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)<br />at $Proxy6.getDataFromDatabase(Unknown Source)<br />at org.myCompany.myAction.load(Unknown Source)<br />at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />at java.lang.reflect.Method.invoke(Method.java:324)<br />at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)<br />at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)<br />at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)<br />at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)<br />at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)<br />at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)<br />at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)<br />at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)<br />at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)<br />at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)<br />at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)<br />at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)<br />at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)<br />at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)<br />at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)<br />at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)<br />at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)<br />at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)<br />at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)<br />at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)<br />at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)<br />at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)<br />at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)<br />at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)<br />at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)<br />at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)<br />at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:280)<br />at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)<br />at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)<br />at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)<br />at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)<br />at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)<br />at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)<br />at com.iplanet.ias.web.WebContainer.service(WebContainer.java:579)</p>
  </blockquote>
  
  <p>This error occurs on a production environment so I don't know which query produced the problem, but I do know that none of my tables has a column named '123'. Do you have any suggestions about what might be causing this problem?</p>
  
  <p><strong>Edit:</strong> As a followup, I found that this behavior is a <a href="http://bugs.mysql.com/bug.php?id=23645">known bug in MySQL 5.0.4</a>, but I haven't found a good wokaround since I don't have the option of upgrading mySQL.</p>