Keeping MySQL DB connection alive

One Star

Keeping MySQL DB connection alive

Hello,
I have a Talend job that executes a stored procedure.  The stored procedure takes a really long time to finish.  Due to this long processing time, the MySQL connection is lost and the job cannot gracefully complete.  I have ensured that all my connections are "using existing connections".  Does anyone know what I can do to keep the connection alive, indefinitely?
Thanks,
Zack
Seventeen Stars

Re: Keeping MySQL DB connection alive

hi
I thinks it's a time out problem.
 you can modify behavior for an instance of connection throught url jdbc driver .
for example, for any  timeout :
jdbc:mysql://localhost:3306/mysql?connectTimeout=0&socketTimeout=0&autoReconnect=true


for more explaination :
http://razorsql.com/docs/help_mysql.html
https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html


hope it helps

regards
laurent
Seventeen Stars

Re: Keeping MySQL DB connection alive

Sometimes this does not help, if the server its self kills the connection. It is always a good design to keep the transaction as short as possible. You should consider to open and close the connection and reopen it again. As a database administrator I would not be happy to see connection open that long.