Page 1 of 1

Mysql: client is using or hasn't closed the table properly

Posted: 20.03.2006, 19:33
by goiasi
Hi.

I created an application that realize an insert in a table in MySQL 4.0. I realized the insert using method ExecSQL
of TZQuery zeosdbo and after that I disconnect from the database using TZConnection.Disconnect.

But executing the command myisamchk it warns about tables closed incorrectly

# myisamchk -s *.MYI
myisamchk: MyISAM file pruebaDesconexion.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly

NOTES: I use Delphi 5 with zeosdbo 6.1.5 and libmysql40.dll.

Posted: 20.03.2006, 23:28
by mdaems
The opening and closing of tables should be done by Mysql after processing the statement. But did you shut down the database server? As long as you do not shutdown or flush the tables (see Mysql Documentation) there's no guarantee that the table is physicaly closed. That's completely normal.

Mark

Posted: 21.03.2006, 12:41
by goiasi
Ok.

I thought it was problem of the client library that doesn't close correctly the connection.

Executing a command FLUSH TABLE <table> after the insert the myisamchk doesn't give the warning. It would be a good practice executing the flush command after the inserts or it slow down much the application? I ask it because if goes the light the tables could be not closed correctly.

Posted: 21.03.2006, 15:20
by mdaems
Well, in my opinion it would NOT be good practice.
Mysql would not keep working this way if it were. I don't remember exactly how they think about this issue. I'm sure it's in the manual. There you can also find a way to flush your tables automaticly if you really have to.
If you need to do the myisamcheck when the database is running, there are safer methods. Please read more about that topic. (the Holy Manual again :roll: )
If it stays unclear to you, jou should consult the mysql forums. They usually know more about this database specific issue.

Posted: 21.03.2006, 17:39
by zippo
I agree - let the server manages the connections. The connections are automatically flushed after a time period.

You should watch those "errors" only if you notice the tables are somehow corrupted.