# Resolving 'Connection.close() has already been called.' when running long db-migration

I tune my datasource appropriate for runtime but also use the same datasource for db-migration activities on application startup. For some particularly long db-migration runs - I began encountering a "Connection.close() has already been called." error.  The easy workaround was to bump the value of MySQL's wait_timeout parameter.

Don't for get to restart MySQL afterwards.

Also - if you're using a dbcp datasource try setting testOnBorrow to true if you have it explicitly set to false.

You're welcome.