"Communications Link Failure" when saving to mysql

I base connected to mysql, every time i save a record, an error appears
image description

Here’s what I have already done:

  • i have set the timeout from 60secs to
    600secs on Connection Pool.

  • i have the code in macro, before oForm.insertrow() or .updaterow()

     oDatasource = ThisDatabaseDocument.CurrentController 
     If Not (oDatasource.isConnected()) Then oDatasource.connect()
    

But after the error dialog appears, and clicking OK, when i .insertrow/.updaterow again, the record is saved. It may seem alright clicking OK for now, but its somewhat annoying in the long run.

Is there a way around this?

Might be this helps:

jdbc:mysql://«Hostname»:3306/«Databasename»?autoReconnect=true

I see you are using JDBC and without autoReconnect the connection will be broken after a very short time.

You have to change the connection as JDBC - not MySQL(JDBC) to fill in the additional command.

1 Like

I think it has something to do with the timeout from the server, it is set at 30secs. Somehow my hosting provider forbids me to edit it to a higher value. So this is my work around.
Before saving a record, I created a dummy SQL commend to the server that doesn’t require writing data, such as getting a value of a field from a row. By this time Base is already reconnected to the server, then on the macro I saved the record. The “Communications Link Error” somehow disappeared.