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

Forum related to version 6.1.5 of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
goiasi
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 20.03.2006, 17:45

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

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
goiasi
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 20.03.2006, 17:45

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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.
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post 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.
Post Reply