Thread:

From
"John Henderson"
Date:
Hi,
Postgresql is installed on server moe and works just fine.
I can access it using PHP scripts located on server moe or server bart.
Pg.pm perl module is installed on server moe.
I can access Postgres just fine using perl cgi's on moe.
Isn't this a nice story?

Now, I want to use a perl script on server bart to access my PG installation
on server moe but to install the Pg module on bart requires that Postgresql
be installed first.

Ultimately, I want to use perl scripts spread all over the network to access
the PG installation on one server only. I don't want to have to install
postgres everywhere just to install the perl module.

I'm sure this is really obvious...advice?
John H




Re: [INTERFACES] Date: Fri, 19 Nov 1999 11:25:20 +1200

From
Lars Strobor
Date:
John,
I have not used pg.pm, but I use DBI all the time. DBI has drivers for
most popular databases, including Postgres of course. All you do is
install DBI and the Postgres driver (the Postgres DBD), then you can
connect to any machine running Postgres. I don't have the URL of the DBI
page, but go to www.perl.com and lookup DBI.

-Lars

On Thu, 18 Nov 1999, John Henderson wrote:

> Hi,
> Postgresql is installed on server moe and works just fine.
> I can access it using PHP scripts located on server moe or server bart.
> Pg.pm perl module is installed on server moe.
> I can access Postgres just fine using perl cgi's on moe.
> Isn't this a nice story?
> 
> Now, I want to use a perl script on server bart to access my PG installation
> on server moe but to install the Pg module on bart requires that Postgresql
> be installed first.
> 
> Ultimately, I want to use perl scripts spread all over the network to access
> the PG installation on one server only. I don't want to have to install
> postgres everywhere just to install the perl module.
> 
> I'm sure this is really obvious...advice?
> John H
> 
> 
> 
> ************
> 



Re: [INTERFACES] Date: Fri, 19 Nov 1999 11:25:20 +1200

From
Jason Earl
Date:
John Henderson wrote:
> 
> Hi,
> Postgresql is installed on server moe and works just fine.
> I can access it using PHP scripts located on server moe or server bart.
> Pg.pm perl module is installed on server moe.
> I can access Postgres just fine using perl cgi's on moe.
> Isn't this a nice story?

It's a great story.  Is there a sequel (SQL :)?

> Now, I want to use a perl script on server bart to access my PG installation
> on server moe but to install the Pg module on bart requires that Postgresql
> be installed first.

All you actually need is the library and include files.  Copy them over
from moe.  If you followed the default install they should be in
/usr/local/pgsql/lib and /usr/local/pgsql/include.  Installing shared
libraries is a little different for each platform, but the fact that you
got these libraries to work on moe is generally a good sign.

> Ultimately, I want to use perl scripts spread all over the network to access
> the PG installation on one server only. I don't want to have to install
> postgres everywhere just to install the perl module.

If you have the libraries properly installed you should be able to
simply copy the relevant parts of your Perl installation over as well. 
A couple of tarballs should be all you need.

Heck, if you are really ambitious it shouldn't be _too_ hard to roll
your own RPM or deb file (assuming of course you are using Linux or a
platform that uses RPM or deb files).

> I'm sure this is really obvious...advice?
> John H

Good Luck,
Jason


Re: [INTERFACES] Date: Fri, 19 Nov 1999 11:25:20 +1200

From
"Hossein S. Zadeh"
Date:
On Fri, 19 Nov 1999, Jason Earl wrote:

> > Postgresql is installed on server moe and works just fine.
> > I can access it using PHP scripts located on server moe or server bart.
> > Pg.pm perl module is installed on server moe.
> > I can access Postgres just fine using perl cgi's on moe.
> > Isn't this a nice story?
> 
> > Now, I want to use a perl script on server bart to access my PG installation
> > on server moe but to install the Pg module on bart requires that Postgresql
> > be installed first.
> 
> > Ultimately, I want to use perl scripts spread all over the network to access
> > the PG installation on one server only. I don't want to have to install
> > postgres everywhere just to install the perl module.


I use a totally different approach to solve the same problem:

Write a perl script that resides on the postgres server and does whatever
you want those "distributed" scripts to do. In addition, it can open a
TCP/IP port and listen on it.

Clients open a TCP/IP connection to the server (to the port), and pass on
the required information to the perl script. The script does its thing and
returns the result(s) back to the client (on the TCP/IP connection), and
closes the connection.

To be able to cater for more than one client at a time, you can write the
perl script to spawn a child to serve each client.

This way the clients need not have Pg.pm. Hell, they don't even need to
have perl. You can use any program that can open a TCP/IP connection
(which means almost everything under the sun--including even VB).

The actual "meat" of the perl script should be around 20-30 lines (except
the postgres stuff of course).

cheers,
Hossein