This is expected as connection was lost when you bounced the database. It is not a good practice to persist a database connection for a long time. You can try to catch the exception if it is queried in a stored procedure.