I have my own database connection pool manager written in Java. It works just fine under normal conditions. But when there are
idle perioids for the system, the pooled Connectins become
idle too and Connections start to drop down.
I can detect that in my code, but when I try to create new Connection to the database bad things start to happen.

Connection con = DriverManager.getConnection(URL, user, password);

it throws:

UNABLE TO CREATE CONNECTION: java.sql.SQLException:Unable to connect to any hosts due to exception:java.net.ConnectException: Connection timed out: connect

Then I manually tried to select stuff from the tables, MySQL prompted:

ERROR 2013: Lost connection to MySQL server during query...ERROR 2006:MySQL server has gone awayNo connection. Trying to reconnect...Connection id: 267Current database: log

Why I can`t create any new Connection and why the MySQL reports those errors? Is there something going on with the DriverManager !?

Your advice appreciated!