Board index » delphi » Indy and Access 97 (Access Violation DAO350.DLL)

Indy and Access 97 (Access Violation DAO350.DLL)

Hi,

Here is my problem :
I want to create a little TCP server that record all thing send to him
in an Access 97 Database
I used TidTCPserver (indy 8), and a  TTABLE.

Here is the event OnExecute of TidTCPserver  :

procedure TForm1.TCPServerExecute(AThread: TIdPeerThread);
var
  S: String;
begin
  with AThread.Connection do  begin
    try
     S := readln;
     table1.append;
     Table1.FieldValues['T1'] := s;
     Table1.FieldValues['IP'] := AThread.Connection.Binding.PeerIP;
     table1.Post;
    finally
    end;
  end;

When i use telnet to log into my server and send a string
i have an exception on TABLE1.POST : AccessViolation at 4A466FD in
DAO350.DLL

I made a button with this code into:

         table1.append;
         Table1.FieldValues['T1'] := 'START';
         Table1.FieldValues['IP'] := '127.0.0.1';
         table1.Post

This one works !

Why the code in  TForm1.TCPServerExecute does not work ?

Thanks all !

Sorry for my bad English, I'm French !

 

Re:Indy and Access 97 (Access Violation DAO350.DLL)


The MS Jet driver (used for MS Access databases) is not thread safe.
There are 2 solutions:
- Only call Post from a single thread (using Synchronize)
- Use ODBC instead of the BDE MSACCESS driver (ODBC still uses MS Jet, but
ODBC itself is threadsafe).

"Yvon Le Roux" <y.leroux_REMOVET...@actris.com> schreef in bericht
news:3B42C871.8E5FDD8D@actris.com...

Quote
> Hi,

> Here is my problem :
> I want to create a little TCP server that record all thing send to him
> in an Access 97 Database
> I used TidTCPserver (indy 8), and a  TTABLE.

> Here is the event OnExecute of TidTCPserver  :

> procedure TForm1.TCPServerExecute(AThread: TIdPeerThread);
> var
>   S: String;
> begin
>   with AThread.Connection do  begin
>     try
>      S := readln;
>      table1.append;
>      Table1.FieldValues['T1'] := s;
>      Table1.FieldValues['IP'] := AThread.Connection.Binding.PeerIP;
>      table1.Post;
>     finally
>     end;
>   end;

> When i use telnet to log into my server and send a string
> i have an exception on TABLE1.POST : AccessViolation at 4A466FD in
> DAO350.DLL

> I made a button with this code into:

>          table1.append;
>          Table1.FieldValues['T1'] := 'START';
>          Table1.FieldValues['IP'] := '127.0.0.1';
>          table1.Post

> This one works !

> Why the code in  TForm1.TCPServerExecute does not work ?

> Thanks all !

> Sorry for my bad English, I'm French !

Other Threads