title: What is SQL Error: 5, SQLState: HY000? and what can cause this error?
body: <p>The application I'm debugging writes randomly/occasionally this exception in its logs.</p>
  
  <pre><code>org.hibernate.util.JDBCExceptionReporter - SQL Error: 5, SQLState: HY000 
  </code></pre>
  
  <p>and an SQL out of memory error associated to this.</p>
  
  <p>While I found in mysql documentation what SQLState: HY000 is, I can't find anywhere what SQL Error 5 is, related to this state.
  Currently I know only that the db connection closes due to this out of memory error, and that the situation doesn't follow any pattern.</p>
  
  <p>Due to the nature of the program adding additional logging messages is not an option. (I can't do that as the application is huge and from what I've seen it happens randomly - different memory size needed for the queries to execute (in the messages) varying from 3 MB to 6 MB).</p>
  
  <p>Any help/information about this exception is appreciated.</p>
  
  <p>Additional information:
  It seems that the out of memory messages come in blocks of 6-50+ requests in an interval of 100-150 milliseconds.
  From a list of about 20-30 error messages, only 3 also appeared in mysql logs, the rest only in tomcat logs (printed the stacktrace).</p>
  
  <p>Thanks</p>