Darmawan Sugiarto wrote:
It's OK... now I know If I don't have this error if I compile my code in first time... but the second, third, and soon I have this error... So I restart Lazarus and my code work clearly...
If I run my exe (without lazarus) I don't have this error...

Hmm, that's interesting. I also had problems with my (commandline) DB aware app 
when running it from Lazarus (Win XP, pressing F9 in Laz): it would not 
connect, but give me an exception instead. When starting it from Explorer or 
the command prompt, all was fine.

IIRC I had this when connecting to both MySQL and MySQL through ODBCt. I always 
thought it was due to the combination of Lazarus + GDB + the MySQL client lib, 
but maybe the problems are more general, as you have this with PostGreSQL.


Just did some tests: the first time I press F9, my program runs successfully, 
but from the the second time on it just keeps raising EODBCExceptions!

Created an empty project with a TODBCConnection and a TSQLTransaction (from the 
SQLDb tab), set properties to connect to my MySQL DB, pressed F9 and voilĂ : 
first time all is ok (after a fresh start of Lazarus), second time not. I now 
also see the error message:

 Could not connect with connection string "DRIVER=MySQL ODBC 3.51 
Driver;UID=myUsername;PWD=myPassword;DATABASE=myDatabase;". ODBC error details: 
Record 1: SqlState: HYT00; NativeError: 2004; Message: [MySQL][ODBC 3.51 Driver]Can't 
create TCP/IP socket (10106).

It is indeed the MyODBC driver complaining here, and the error is 'Can't create 
TCP/IP socket'.

Tried to use TMySQL50Connection; same behaviour, though I get a different 
Exception: it complains that it can't find libmysql.dll. Again, this exception 
does not occur when running from Explorer or the first time after Lazarus 
starts.

Copy & pasted libmysql.dll to the local directory: now I get a 
'MySQL50Connecion1 : Server connect failed' message. (But first time all is ok; 
also when ran from Explorer.) Not a very informative error, but I bet it is again 
due to the Can't create TCP/IP socket error. IIRC back in the days my commandline 
DB app mentioned above connected using the MySQL client lib directly (instead of 
though ODBC) I got the 'Can't create TCP/IP socket' error when ran from Laz. (I 
never noticed back then that this error did not occur when running it the first 
time.)

Tried to reset the debugger in Lazarus (Run -> Reset debugger): ah right, now I 
can run my program one time without failures again. Note: From GDB (ran from 
cygwin) I can run my test program as often as I want, but this is of course not 
the same GDB executable, neither does it receive the same parameters and input as 
the Laz GDB.

Unfortunately I do not have a PosrtGres db engine set up, so I can't test that 
at the moment.


Maybe something is going wrong with the environmental variables??? Why can't it 
suddenly find the mysql lib? And why can't the mysql client connect?

My Lazarus is 0.9.20, FPC 2.0.4, OS: Win XP SP2, MySQL client & server: 5.0.27 
for Win32. (I also had this error in times when I worked with MysQL 4.x or maybe 
even 3.x)


Any ideas?


Regards,

Bram

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to