Thread: using POSTGRES in a network

using POSTGRES in a network

From
"hiroko"
Date:
we're now developping a system on Linux, using PostgreSQL.
and the question this time is about
how to connect to the DBserver through the network (ex,ethernet) from clients.
especially on CODINGS.
 
we found a lot of info about the way of connecting
 between DBserver on Linux and Windouws user.
but few about the Linux-Linux DBconnection, which we do need.
is anybody knows about this? or have anyone tried it before?
 
when you connect to the remote DBserver from Windows,
what you need is to set the IP of the server in "hosts"file
and to set your IP as DBuser to the server machine.
and you can access through the command-line, using "psql"
but if you wannna do this on the programs??????
can you do the same thing using the function such as "db_connect" or PGDBfunctions???
we also need the info about this.
 
we do appreciate for your reply . thanks.
 
hiroko
 
 

Re: using POSTGRES in a network

From
Peter Eisentraut
Date:
hiroko writes:

> when you connect to the remote DBserver from Windows,
> what you need is to set the IP of the server in "hosts"file
> and to set your IP as DBuser to the server machine.
> and you can access through the command-line, using "psql"
> but if you wannna do this on the programs??????
> can you do the same thing using the function such as "db_connect" or
> PGDBfunctions???

This depends on what language interface you use for your program.  Each
language has a function/command to initiate a database connection, and
that function usually has an option to select the address of the server
host.  See the documentation of the respective interface.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: using POSTGRES in a network

From
John Burski
Date:
hiroko wrote:

> we're now developping a system on Linux, using PostgreSQL.and the
> question this time is abouthow to connect to the DBserver through the
> network (ex,ethernet) from clients.especially on CODINGS. we found a
> lot of info about the way of connecting between DBserver on Linux and
> Windouws user.but few about the Linux-Linux DBconnection, which we do
> need.is anybody knows about this? or have anyone tried it before?

Oh, yeah!  The first thing you'll want to do is to edit the pg_hba.conf
file on the server to permit connections from the Linux clients in
question.  Since you're already allowing Windows clients to connect via
network, you're probably aware of that.

Connecting to the database server via the command line is relatively
easy.  The following example is based on version 6.5.3, but the commands
should be similar for more recent versions:

     psql -h <server> -u <database>

"server" is the name of the server you wish to connect to.  It can be
either an IP address (like 192.168.1.10), an entry in the client's
/etc/hosts file, or available via DNS (we use DNS).  "database" is the
name of the specific database you want to connect to, like "template1"
or what have you.

The above command, once submitted, will request a user ID and password
to complete the connection.  Once the connection is established it's
just like running an interactive session on your localhost.


> when you connect to the remote DBserver from Windows,what you need is
> to set the IP of the server in "hosts"fileand to set your IP as DBuser
> to the server machine.and you can access through the command-line,
> using "psql"but if you wannna do this on the programs??????can you do
> the same thing using the function such as "db_connect" or
> PGDBfunctions???we also need the info about this. we do appreciate for
> your reply . thanks. hiroko

You can connect to the server from within several programming
"environments" (PHP, Perl, C, and C++ come to mind).  The relevant C and
C++ libraries are provided with the PostgreSQL distributions.  You can
learn more about those by studying the Programmer's Guide.

The Perl modules are available from CPAN.  Check out http://www.perl.com
and follow the links.

For more information about PHP connectivity, check out
http://www.php.net.

Hope this helps.

--
John Burski
I.T. Manager
911 Emergency Products
25 Sixth Avenue North
St. Cloud, MN  56303
(320) 656 0076       www.911ep.com

++++++++++++++++++++++++++++++++++
+ How's your cheese holding out? +
++++++++++++++++++++++++++++++++++