Error with MySQL 4.1

When I start the client and open a solution accessing data on MySQL 4.1 I have this error log:

select prodotti.id from prodotti order by prodotti.versione desc 
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Broken pipe STACKTRACE: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2616) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2547) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1512) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622) at com.mysql.jdbc.Connection.execSQL(Connection.java:2379) at com.mysql.jdbc.Connection.execSQL(Connection.java:2306) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1706) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.servoy.j2db.persistence.datasource.p.invoke(Unknown Source) at $Proxy1.executeQuery(Unknown Source) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source) at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) at java.lang.Thread.run(Thread.java:534) ** END NESTED EXCEPTION ** 
select prodotti.id from prodotti order by prodotti.versione desc 
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1842) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2288) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622) at com.mysql.jdbc.Connection.execSQL(Connection.java:2379) at com.mysql.jdbc.Connection.execSQL(Connection.java:2306) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1706) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.servoy.j2db.persistence.datasource.p.invoke(Unknown Source) at $Proxy1.executeQuery(Unknown Source) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source) at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) at java.lang.Thread.run(Thread.java:534) ** END NESTED EXCEPTION ** 
select prodotti.id from prodotti order by prodotti.versione desc 
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1842) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2288) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622) at com.mysql.jdbc.Connection.execSQL(Connection.java:2379) at com.mysql.jdbc.Connection.execSQL(Connection.java:2306) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1706) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.servoy.j2db.persistence.datasource.p.invoke(Unknown Source) at $Proxy1.executeQuery(Unknown Source) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source) at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) at java.lang.Thread.run(Thread.java:534) ** END NESTED EXCEPTION **

Often closing the client and reopening solve the problem.

I use mysql connector 3.1.8.
Is a driver problem or a Servoy problem?

It is a known problem with MySQL-Connector, if the Servoy server is being idle for a long time the connections are dropped by MySQL but Servoy doesn’t know and throw this error in the log.
The only solution at the time being is to use a query validation like “select 1” for validating Servoy connections to the backend, doing this you loose a little speed overall but you solve the problem (the error is thrown in the log anyway but Servoy is able to reopen the idled connections so you don’t get client errors anymore).
So go to Server Administration/Database Server and change the Query validation type to “Query Validation” and set the validation query to “select 1” for all the connections to a MySQL DB (even your repository if it resides in MySQL).
I’ve reported this bug before so if you need further assistance look in the Issues and Bug forum for an old post of mine regarding MySQL.
I really hope that guys at servoy will find a way to resolve this issue (i know it’s not their fault) because it’s really annoying to have the log full of crap when you look for a ‘real’ error message. And loosing that little speed using the validation query is not so nice too… ;-)

Thank you Nicola, but the error is shown even on client, not only in the log.
Anyway I’ll try your solution.

a.mariottini:
Thank you Nicola, but the error is shown even on client, not only in the log.
Anyway I’ll try your solution.

If you use Query Validation the error will only be logged and the client will work fine.