Page 1 of 1
tcp/ip server and MyDAC
Posted: Sun 19 Apr 2009 19:48
by intelworker
I found this site and started to test MyDAC before purchasing. I'm developing tcp/ip server where every connected tcp/ip client will be authenticated by verifying username and password from mysql database from "users" table. I see that the work of MyDAC is based on visual interface like datasources linked with dbgrids etc, but i don't need any visual interfaces. Can you show me an example, which components should be used for such purposes? And our MySQL database uses UTF8 encoding, maybe I should use unicode enabled MyDAC components?
Here is Delphi 2007 used for coding. Thank you.
Posted: Sun 19 Apr 2009 20:15
by jkuiper
Code: Select all
use MyAcces;
var MyConnection: TMyConnection;
MyQuery : TMyQuery;
begin
try
Myconnection := TMyConnection.Create(nil);
// setup de username, password, database and server
....
MyQuery := TMyQuery.Create(nil);
MYQuery.Connection := MyConnection;
// do your thing
finally
MyQuery.active := false;
MyQuery.free;
MyConnection.free;
end;
end;
Re: tcp/ip server and MyDAC
Posted: Tue 21 Apr 2009 09:08
by Dimon
intelworker wrote:And our MySQL database uses UTF8 encoding, maybe I should use unicode enabled MyDAC components?
You should use the Unicode build if you use UTF8 characters in SQL queries, table names or field names. But if you use UTF8 characters only in fields values in database tables then you don't need to use the Unicode build.
Posted: Fri 01 May 2009 17:25
by intelworker
Thank you. And what about non-blocking(event driven) component? Is there such component? Because there can be problems if I will use thread for sql query in tcp client thread. If it is possible please show me an example. Thanks.
Posted: Tue 05 May 2009 08:47
by Dimon
If you mean thread safety, then MyDAC can work in multithreaded applications, so it is thread safe. But the restriction is that you cannot use one component for more than one thread simultaneously.