I randomly got this error
java.sql.SQLException: Io exception: Bad packet type
I did some research, someone suggested a solution:
To correct this problem we have to ensure that only one thread of execution was making use of the JDBC driver at a time through the same Connection OR upgrade to a later version of the driver.
Can anyone guide me in how to ensure that only one thread of execution was making use of the JDBC driver at a time ?
解决方案
We resolved the problem by closing the connection of a preparedStatement, instead of the Database connection itself.
Use:
ps.getConnection().close();
instead of :
conn.close();