MySQL over ODBC on a remote server: constant "file not open" errors, "MySQL server has gone away (08S01)"

Applies to: reported in 2010 with the MySQL ODBC 5.1.7 client; the Clarion version is not named.

Problem

An app tested against a MySQL database hosted far away, through a simple ODBC connect string (Driver={MySQL ODBC 5.1 Driver};Server=...;Database=...;Uid=...;Pwd=...;), kept failing with "file not open" and "file not found" errors. A desktop SQL tool connected to the same database without trouble.

Solution

  1. Check whether the error is errorcode 90 with FILEERRORCODE() = '08S01'. In the thread it was: "MySQL server has gone away (08S01)".
  2. One poster handled it by testing before any database access: OPEN the file, and if it fails with that errorcode and FILEERRORCODE(), retry the OPEN. The retry most likely succeeds. With the Clarion file manager (FM3) use CLAOPEN().
  3. The original poster considered opening a dummy file repeatedly from the frame.

Caveats

  • The MySQL connection timeout was said to be 4 hours by default, yet the error came every few minutes; the cause was not found in the thread.
  • A third-party demo app on the other poster's own server did not show the error. Adding /BUSYHANDLING=2 /VERIFYVIASELECT=TRUE to the files in the dictionary did not help. The other poster suggested trying the two tables on that server to tell a server timeout setting from a client problem; the result was not posted.
  • The original poster saw the errors on a window with a parent browse plus a child browse; a single browse seemed stable.
  • The port was missing from the connect string; it was not judged to be the cause.

Today (2026)

Not re-tested. The retry-the-OPEN idea is a mitigation reported by one poster, and the current MySQL ODBC drivers and server settings may behave differently.

Sources: Geoff B. (Aug 2010, the question), JP G., John T. (Aug 2010) in softvelocity.clarion.databasedrivers.