PHenningsen
asked on
Apache DSO (in Kylix) won't connect using dbExpress
I'm using Kylix 3 to write an Apache (1.3.33) DSO with SuSE Linux 9.2
Using dbExpress (TSQLConnection & TSQLQuery) to access a Firebird database.
Konqueror says "connection to host <host_name> was lost."
MSIE says "page not found"
A relatively similar app works fine as a CGI
I read in http://www.rick-ross.com/papers/k3/k3deploy.html#DSOAppshttp://www.rick-ross.com/papers/k3/k3deploy.html#DSOApps that "Also, the LANG environment variable must be set to an appropriate value within the httpd.conf file as well. Specifying the location of the database configuration files, the HOME environment variable should be set to the directory that contains the .borland subdirectory. If a HOME directory is not set, the global configuration file located in /usr/local/etc will be used."
Could this be the problem?
I don't know how to set HOME in httpd.conf... And what should I set it to? And where?
Thanks for any help!
Using dbExpress (TSQLConnection & TSQLQuery) to access a Firebird database.
Konqueror says "connection to host <host_name> was lost."
MSIE says "page not found"
A relatively similar app works fine as a CGI
I read in http://www.rick-ross.com/papers/k3/k3deploy.html#DSOAppshttp://www.rick-ross.com/papers/k3/k3deploy.html#DSOApps that "Also, the LANG environment variable must be set to an appropriate value within the httpd.conf file as well. Specifying the location of the database configuration files, the HOME environment variable should be set to the directory that contains the .borland subdirectory. If a HOME directory is not set, the global configuration file located in /usr/local/etc will be used."
Could this be the problem?
I don't know how to set HOME in httpd.conf... And what should I set it to? And where?
Thanks for any help!
ASKER
Thanks. So did I. But, unfortunately, no answer.
Have you (or anyone) gotten a DSO to access a Firebird db using dbExpress?
Have you (or anyone) gotten a DSO to access a Firebird db using dbExpress?
Yeah, I for sure I did..but I got it at work
(configuration of apache) so I have to get
there first :)
But basically I had no problem:
1) installing apache
2) installing firebird
3) adding firebird functionality into httpd.conf
4) running both
5) compiling Web Service under the Kylix
6) adding it as LoadModule into httpd.conf
7) restarting apache
regards,
Kate
(configuration of apache) so I have to get
there first :)
But basically I had no problem:
1) installing apache
2) installing firebird
3) adding firebird functionality into httpd.conf
4) running both
5) compiling Web Service under the Kylix
6) adding it as LoadModule into httpd.conf
7) restarting apache
regards,
Kate
ASKER
Hi,
I think you misunderstood. The DSO works fine without the dbExpress components. It's just when I execute the SQLConnection1.Open statement that it doesn't. The error is something like "connection lost" from Konqueror.
The program also works fine as a standalone GUI exe. I haven't tried it yet as a CGI.
I think that Apache can't find one of the "support" SO's, like /usr/lib/libgds.so or /home/phil/kylix3/bin/libs qlib.so and libmidas.so. Although it's strange that the code fails when the Open statement is executed, not when the module is loaded.
http.conf contains:
LoadModule aftest_module /home/phil/Projects/aftest /bin/libaf test.so
<Location /aftest>
SetHandler aftest-handler
</Location>
SetEnv LD_LIBRARY_PATH /home/phil/kylix3/bin
SetEnv LANG en_US
but it does not contain anything referencing /usr/lib. Should it?
Regards,
Phil
I think you misunderstood. The DSO works fine without the dbExpress components. It's just when I execute the SQLConnection1.Open statement that it doesn't. The error is something like "connection lost" from Konqueror.
The program also works fine as a standalone GUI exe. I haven't tried it yet as a CGI.
I think that Apache can't find one of the "support" SO's, like /usr/lib/libgds.so or /home/phil/kylix3/bin/libs
http.conf contains:
LoadModule aftest_module /home/phil/Projects/aftest
<Location /aftest>
SetHandler aftest-handler
</Location>
SetEnv LD_LIBRARY_PATH /home/phil/kylix3/bin
SetEnv LANG en_US
but it does not contain anything referencing /usr/lib. Should it?
Regards,
Phil
ASKER
I have "remade" the app as a CGI app.
The call to SQLConnection1.Open is in a try..except block.
I am receiving the exception:
Access violation at address 080B275C, accessing address 000000A4
Hmmmm.
The call to SQLConnection1.Open is in a try..except block.
I am receiving the exception:
Access violation at address 080B275C, accessing address 000000A4
Hmmmm.
ASKER
The CGI app now works. The DSO still does not with "Connection to host <host> is broken." On top, it says "An error occurred while loading" although the error actually happens when the page containing the SQLConnection.Open statement is executed.
Re the CGI app: I had built both the CGI & DSO versions from a previous standalone GUI version. In doing so, I moved the dbExpress calls to a new unit but neglected to add "DBXpress, FMTBcd, SqlExpr" to the main "uses" clause. Adding them (to both) makes the CGI version work. The DSO still does not work.
Re the CGI app: I had built both the CGI & DSO versions from a previous standalone GUI version. In doing so, I moved the dbExpress calls to a new unit but neglected to add "DBXpress, FMTBcd, SqlExpr" to the main "uses" clause. Adding them (to both) makes the CGI version work. The DSO still does not work.
ASKER
Wow, this is wierd....
I "misspoke" myself earlier. The CGI app did not work. Somebody must have spiked my coffee. :-)
So, I set about to make the CGI app work. What was the difference between my app and the demo app from http://bdn.borland.com/article/images/28556/apache_development.pdf which works?
The (condensed) code from the demo is:
procedure TWebModule1.WebModule1WebA ctionItem2 Action(Sen der: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
SQLConnection1.Open;
SQLQuery1.SQL.Text := 'select emp_no, first_name, last_name from employee '+
'where first_name like '+'"'+Request.ContentField s.Values[' empname']+ '"';
SQLQuery1.Open;
DataSetTableProducer1.Data Set := SQLQuery1;
Response.Content := DataSetTableProducer1.Cont ent;
SQLQuery1.Close;
SQLConnection1.Close;
end;
All of the dbExpress statements were within the WebModule Action OnAction event. Mine were called by the OnAction event but lived in a totally different unit. So I moved some of the dbExpress code to new paragraphs within the the Web Module itself. Same problem. So I moved the SQLConnection1.Open statement within the OnAction event itself. It connected! So I moved a sample query into the OnAction event itself. It worked!
Right now I'm of the opinion that all of the dbExpress statements must live in the WebModule Action OnAction event. This makes for some very, very bad code.
Does any of this make any sense?
Regards,
Phil
I "misspoke" myself earlier. The CGI app did not work. Somebody must have spiked my coffee. :-)
So, I set about to make the CGI app work. What was the difference between my app and the demo app from http://bdn.borland.com/article/images/28556/apache_development.pdf which works?
The (condensed) code from the demo is:
procedure TWebModule1.WebModule1WebA
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
SQLConnection1.Open;
SQLQuery1.SQL.Text := 'select emp_no, first_name, last_name from employee '+
'where first_name like '+'"'+Request.ContentField
SQLQuery1.Open;
DataSetTableProducer1.Data
Response.Content := DataSetTableProducer1.Cont
SQLQuery1.Close;
SQLConnection1.Close;
end;
All of the dbExpress statements were within the WebModule Action OnAction event. Mine were called by the OnAction event but lived in a totally different unit. So I moved some of the dbExpress code to new paragraphs within the the Web Module itself. Same problem. So I moved the SQLConnection1.Open statement within the OnAction event itself. It connected! So I moved a sample query into the OnAction event itself. It worked!
Right now I'm of the opinion that all of the dbExpress statements must live in the WebModule Action OnAction event. This makes for some very, very bad code.
Does any of this make any sense?
Regards,
Phil
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I contend that it is "not possible" in an Apache CGI or DSO written in Kylix.
Can anyone show me where I'm wrong?
Regards,
Phil
Can anyone show me where I'm wrong?
Regards,
Phil
http://bdn.borland.com/article/images/28556/apache_development.pdf
regards,
Kate