I am very uninformed when it comes to databases, but access violations happens when you do stuff to stuff that's not there.<br><br>My guess is that for some reason your "close" code gets fired twice, and thus it's already closed by the time you get there the second time.<br>
<br>So if there's a way to check if it's open, before you close it, I'd suggest try to close it inside an if open...<br><br>Regards,<br>-Reenen<br><br><div class="gmail_quote">On Sun, Jan 18, 2009 at 9:39 PM, waldo kitty <span dir="ltr"><<a href="mailto:wkitty42@windstream.net">wkitty42@windstream.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
history: i'm a long time pascal coder... since TP3 first appeared on the<br>
market... then to TP5 and most of my time with TP6/BP6 and numerous commercial<br>
apps under my belt... i've dabbled with OOP stuffs, TP7/BP7 and even have a copy<br>
of delphi6-personal that i've not been able to wrap my head around... since my<br>
delphi was a downloaded copy from Inprise, it is also a bit harder to work with<br>
since i've no real documentation that i can lay in my lap to look over while<br>
working on code :? :(<br>
<br>
in any case, i've been fighting a battle with mysql50conn for a few weeks,<br>
now... i started with Lazaruz 0.9.26 and last night installed Lazarus 0.9.27 to<br>
see if the problem i'm facing may have been fixed in there but it has not and<br>
i'm not even certain if the problem is in the library code or possibly something<br>
on this old win98SE box :?<br>
<br>
ok, enough of the history and story telling...<br>
<br>
the details: with the tutorial DB code on the wiki (yeah, i was /finally/ able<br>
to get two or three of those working after some starts, stops and fits :P),<br>
there's several that check to see if the connection to the database is active<br>
and if it is, they attempt to close it... my problem is that the first attempt<br>
to close the connection _always_ throws an error... i don't know what specific<br>
error code because the popup box doesn't state it... the box only says<br>
<br>
Access violation.<br>
<br>
Press Ok to ignore and risk data corruption.<br>
Press Cancel to kill the program.<br>
<br>
[OK] [Cancel]<br>
<br>
i'm triggering my initial connection to the database via a button. i click the<br>
button, the connection takes place, data is retrieved, and the connection is<br>
attempted to close... that's when the error is thrown... however, if i hit the<br>
[OK] button to ignore the error then i can open and close the connection to the<br>
database with no problems... at least it appears that way because other routines<br>
gather other data from other tables and they all connect, gather, and disconnect<br>
without problems... all routines use the very same disconnect routine and this<br>
is what leads be to believe that there's something in the library code that's<br>
the problem...<br>
<br>
currently, all the code i'm using simply uses the close procedure of the<br>
connection object (ie: MySQL50Connection.Close)... i've only one graphical demo<br>
app that doesn't exhibit this problem but it is using mysql4 in the uses and a<br>
lot of manual code instead of the connector, transaction, and sqlquery<br>
objects... i also have the text modedemo app working and it doesn't have the<br>
problems either... now, i'm not sure, at all, if any of the (demo) apps i'm<br>
working with are using the libmysql.dll file that i placed in my<br>
windows/system(32?) directory or not... i believe that the textmode demo would<br>
not run without that dll but that was several weeks ago when i was playing with<br>
it and it was also in the plain FPC 2.2.2 installation i have/had on here before<br>
i figured out that Laz came with FPC in its tree...<br>
<br>
for those who want/need a link to example code that exhibits this problem, i'm<br>
using the downloaded code "TryMySQL5 Modified by Arwen" but i can't find the<br>
link in the wiki now :( in any case, this is the TryMySQL5 demo app with the<br>
fields for the server, username, and password rather than them being<br>
hardcoded... once you fill them in, then you click the [Connect] button to<br>
connect to the server and get a list of available databases... now you choose a<br>
database from the combo box and then click the [Select Database] button... it is<br>
at this point that the error is thrown when the connection is closed and<br>
reopened so the new database can be used...<br>
<br>
<br>
FWIW:<br>
here's the memo field "log" with the error point marked with '>>' and yes, i've<br>
slightly modified the "logging" to try to figure out where the error is taking<br>
place and every time the last line logged before the popup box appears is the<br>
one right above the mysql50connection.close line...<br>
<br>
14:26:18: Opening a connection to server: ender<br>
14:26:19: Connected to server: ender<br>
14:26:19: Retreiving list of available databases.<br>
14:26:19: Query ACTIVE and at the first record<br>
14:26:19: List of databases received!<br>
>>14:26:26: Closing connection<br>
14:26:33: Closing connection<br>
14:26:33: Connection closed...<br>
14:26:33: DatabaseComboBox.ItemIndex: 2<br>
14:26:33: DatabaseComboBox.Items[ItemIndex]: kims<br>
14:26:33: setting SQL statement...<br>
14:26:33: Retrieving list of tables<br>
14:26:33: opening sql query...<br>
14:26:34: List of tables received<br>
<br>
so, at 14:26:26, i clicked the [Select Database] button and then clicked the<br>
[OK] button in the error box and then i clicked on the [Select Database] button<br>
again (14:26:33)...<br>
<br>
so, there it is with all my wordiness and verbiage... oh, and the hidden subtle<br>
"am i linked?" test message ;)<br>
<br>
so, is it me or is it a bug in the library? if the library, which library? Laz<br>
stuff or FPC stuff?<br>
<br>
--<br>
NOTE: NEW EMAIL ADDRESS!!<br>
<br>
_\/<br>
(@@) Waldo Kitty, Waldo's Place USA<br>
__ooO_( )_Ooo_____________________ telnet://<a href="http://bbs.wpusa.dynip.com" target="_blank">bbs.wpusa.dynip.com</a><br>
_|_____|_____|_____|_____|_____|_____ <a href="http://www.wpusa.dynip.com" target="_blank">http://www.wpusa.dynip.com</a><br>
____|_____|_____|_____|_____|_____|____ <a href="ftp://ftp.wpusa.dynip.com" target="_blank">ftp://ftp.wpusa.dynip.com</a><br>
_|_Eat_SPAM_to_email_me!_YUM!__|_____ wkitty42 -at- <a href="http://windstream.net" target="_blank">windstream.net</a><br>
<br>
<br>
---<br>
avast! Antivirus: Outbound message clean.<br>
Virus Database (VPS): 090117-0, 01/17/2009<br>
Tested on: 1/18/09 14:39:07<br>
avast! - copyright (c) 1988-2009 ALWIL Software.<br>
<a href="http://www.avast.com" target="_blank">http://www.avast.com</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a><br>
<a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>o__<br>,_.>/ _<br>(_)_\(_)_______<br>...speed is good<br>_______________<br>I believe five out of four people have a problem with fractions.<br>