Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache 2.2 + Windows 7 + Delphi 7 Web Application + ADO |
|
Author |
|
MarkZA
Joined: 19 Sep 2012 Posts: 1 Location: South Africa
|
Posted: Thu 20 Sep '12 14:54 Post subject: Apache 2.2 + Windows 7 + Delphi 7 Web Application + ADO |
|
|
Good Day
I am hoping that someone can shed some light on a problem I am experiencing. I have been searching now for 2 days flat for a solution with no luck
We currently have a Delphi 7 Web Application connection to an Informix database through the BDE. This works 100% fine on Windows XP and Windows 7
I have been tasked however to remove the BDE dependency and replace with ADO which I have done successfully (well so I thought). The new ADO dependant Web Application works 100% fine on Windows XP but when round on Windows 7 or Windows Servere 2008 SP2 I get the following error
Exception: EOleSysError
Message: The specified module could not be found
The Apache and Windows Event Log files lend no light as to what the problem might be. I am not even sure if it is an Apache problem but I have to try ever permutation
I am thinking it has something to do with security privileges on Windows 7
If I run the Web Application through the Delphi 7 IDE on Windows 7 then the application works fine but when used through the browser it gives the error above. I am assuming that Delphi 7 has better privileges than apache but am not sure
I have had suggestions of shipping the ADO DLL's but am not sure where and what these would be
I have downloaded and installed MDAC 2.8 but this has not solved the problem either
I have added event logging to my web application which gets logged if I simply run the exe but when I try to used the CGI web application through the browser no logging occurs
Any advice is appreciated as I am stumped
Mark |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 22 Sep '12 23:37 Post subject: Re: Apache 2.2 + Windows 7 + Delphi 7 Web Application + ADO |
|
|
MarkZA wrote: | I am assuming that Delphi 7 has better privileges than apache but am not sure
|
You can a) change the user apache service runs with or b) run apache in a console so it runs with the same priviliges as the IDE |
|
Back to top |
|
ddowns
Joined: 02 Oct 2012 Posts: 1 Location: USA, Michigan
|
Posted: Wed 03 Oct '12 19:54 Post subject: Delphi 7 Apache DSOs |
|
|
Here's how I handle ADO for apache DSOs.
First up I include my ComInit.pas file in the .dpr, usually right above WebBroker.
Code: | unit ComInit;
interface
uses
ActiveX,
ComObj;
implementation
initialization
CoInitFlags := COINIT_MULTITHREADED;
CoInitializeEx(nil,COINIT_MULTITHREADED);
finalization
CoUninitialize;
end.
|
In my project dpr
Code: |
uses
SysUtils,
ComInit,
WebBroker,
........
|
In my webmodule:
Code: | procedure TwmWebSite.WebModuleBeforeDispatchDispatch(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
CoInitializeEx(Nil, COINIT_MULTITHREADED);
end;
procedure TwmWebSite.WebModuleAfterDispatch(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
CoUnInitialize;
Handled := True;
end;
|
For CGI apps its much easier:
Include: ADODB, comobj, activex
I use a ADOConnection property on the webmodule like so:
Code: | function TWebModule1.GetADOConnection: TADOConnection;
var
IniFile : TIniFile;
DataSource : String;
begin
if NOT Assigned(FADOConnection) then
begin
IniFile := TIniFile.Create(ChangeFileExt(ParamStr(0),'.ini'));
try
DataSource := IniFile.ReadString('Settings','DataSource','(local)');
finally
IniFile.Free;
end;
CoInitialize(Nil);
FADOConnection := TADOConnection.Create(nil);
with FADOConnection do begin
ConnectionString := 'Provider=SQLOLEDB.1;........';
LoginPrompt := False;
Provider := 'SQLOLEDB.1';
end;
FADOConnection.Open;
end;
Result := FADOConnection;
end;
|
Along with a cleanup procedure
Code: | procedure TWebModule1.CleanupCOM;
begin
if Assigned(FADOConnection) then
begin
FADOConnection.Close;
FADOConnection.Free;
FADOConnection := nil;
CoUnInitialize;
end;
end;
procedure TWebModule1.WebModuleAfterDispatch(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
CleanupCOM;
Handled := True;
end;
|
This will get around all sorts of weird ADO issues that can come up, especially if you're doing an apache DSO or ISAPI dll. |
|
Back to top |
|
|
|
|
|
|