EAccessViolation message from Web Server dll

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
ChrisDavis
Posts: 3
Joined: Tue 23 Oct 2007 23:11

EAccessViolation message from Web Server dll

Post by ChrisDavis » Thu 25 Oct 2007 10:24

Hi,

I'm developing a web server (ISAPI) application in C++Builder 2007 using the latest dbExpress drivers. The app complies fine but when the statement TCRSQLConnection->Connected = true is executed, it generates an EAccessViolation message (the same happens using Borland's version of the drivers). I have used identical code in a standard desktop application and it works fine.

Any thoughts??


Regards,
Chris

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 29 Oct 2007 08:50

We could not reproduce the problem.
Please send me a complete small sample at dbxsda*crlab*com to demonstrate it, including script to create server objects if it is necessary.

Also supply me the following information:
- exact version of DbxSda;
- exact version of your IDE (including installed update packs);
- exact version of SQL Server.

semike
Posts: 7
Joined: Thu 15 Nov 2007 19:30

Post by semike » Thu 15 Nov 2007 19:40

Hello Chris,

though the connection will be used in a separate thread you have to initialize ole:

Code: Select all

CoInitialize(nil);
MyConnection.Connected := true;
Without this initialization the connect will raise an exception.

I derived a derivation of TSQLConnection performing this initialization automatically in DoConnect method:

Code: Select all

procedure TktDBConnection.DoConnect;
begin
  try 
    CoInitialize(nil); 
  except 
     // we do not want any exceptions here
  end;

  inherited;

  // retrieve internal database informations here 
end;
Hope this helps.

Michael

Post Reply