Search Postgresql Archives

Accessing a database via AJAX scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am not sure where my issue lies - apache, perl or postgresql, but as they say, one has to start somewhere.

My goal is to have a perl cgi script (that is accessed using AJAX) perform some operations in a database using DBI. Some of the actions are likely to take a while so my intent was to have a table that the backend process periodically writes status messages into. The front end web page then uses another AJAX script to watch this table.

I am coming unstuck, the monitoring script works but the backend processing doesn't.

My first attempts would not show anything at the front end as the initial response from the backend was not getting through the system until the backend completely finished (even having set no buffering on STDOUT). After googling abit, it would appear that the way around this is to fork the back-end to allow apache to complete the initial response and then carry on the processing in the forked child process. I have opted to use Proc::Daemon to do this. Now I am getting a Pg error "could not receive data from server: Bad file descriptor".

I have attempted re-opening STDOUT and STDERR in the forked process but that didn't make any difference.

I am obviously missing something here. If anyone has done something similar and has it working I'd appreciate any help I can get.

Glen
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen and Rosanne Eustace,
GodZone Internet Services, a division of AGRE Enterprises Ltd.,
P.O. Box 8020, Palmerston North, New Zealand 4446
Ph: +64 6 357 8168, Fax: +64 6 357 8165, Mob: +64 27 542 4015

"A Ministry specialising in providing low-cost professional Internet
Services to NZ Christian Churches, Ministries and Organisations"

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux