Page 1 of 1

EAccessViolation message from Web Server dll

Posted: Thu 25 Oct 2007 10:24
by ChrisDavis
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

Posted: Mon 29 Oct 2007 08:50
by Antaeus
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.

Posted: Thu 15 Nov 2007 19:40
by semike
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