tcp/ip server and MyDAC

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
intelworker
Posts: 2
Joined: Sun 19 Apr 2009 19:32

tcp/ip server and MyDAC

Post by intelworker » Sun 19 Apr 2009 19:48

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.

jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Post by jkuiper » Sun 19 Apr 2009 20:15

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; 

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Re: tcp/ip server and MyDAC

Post by Dimon » Tue 21 Apr 2009 09:08

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.

intelworker
Posts: 2
Joined: Sun 19 Apr 2009 19:32

Post by intelworker » Fri 01 May 2009 17:25

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.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 05 May 2009 08:47

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.

Post Reply