Database Connections to MySQL get lost

JobScheduler 

Question:

I encounter the error:

Error connecting to [host]:[port]: SOS-JAVA-105 Java-Exception java.sql.SQLException("No operations allowed after connection closed."), methode=rollback []

Answer:

If the connection to your MySQL database was idle for some hours without any jobs running, then MySQL will close the connection without telling this to the client, i.e. JobScheduler.

Solution:

  • To change this behavior you can change the value of the system variable wait timeout. This value assigns the maximum duration in seconds of non-interactive idle connections to the database.
  • Alternatively you could run a job like scheduler_dequeue_mail that is more frequently repeated; this job dequeues mails that have previously been stored in case of a failure of your mail server and creates a history record in the database even if no mails are to be sent.

JOC Cockpit :

Question:

I encounter the error:

ERROR qtp1973336893-20 c.s.j.c.JOCDefaultResponse                   - DBInvalidDataException: java.sql.SQLNonTransientConnectionException: Last stream not finished

Screenshot :

Answer :

  • To change this behavior you can change the value of the system variable wait_timeout. This value assigns the maximum duration in seconds of non-interactive idle connections to the database.

How to Change MySQL wait_timeout :     

  • Steps to change the wait_timeout server system variable
    1. Login into database which is used by JOC Cockpit via MySQL command line or any other MySQL GUI client such as MySQL Workbench. (Note: the following commands will only be effective for the currently selected database.)
    2. Set wait_timeout variable's value by running following command. Refer to the following article to get the default and maximum values for idle wait_timeout for your platform: 
      1. Server System Variables : wait_timeout.
      • The following setting would set the timeout to 24 hours:
        • set @wait_timeout = 86400; (the value is set in seconds)
    3. Check the updated value of the wait_timeout variable by running the following command:
      • select  @wait_timeout;
    4. Restart your JOC Cockpit Windows service or Linux demon, to create a new database connection between JOC Cockpit and MySQL.