From: | Peter T Mount <peter(at)retep(dot)org(dot)uk> |
---|---|
To: | Elaine Arajo <elaine(at)compacto(dot)nexos(dot)com(dot)br> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: [INTERFACES] PostgreSql-users and passwords |
Date: | 1998-07-09 17:15:40 |
Message-ID: | Pine.LNX.3.96.980709180533.1647D-100000@maidast.retep.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
[only just saw this one was about java]
On Mon, 6 Jul 1998, Elaine Arajo wrote:
>
> I'm bening to work with Java an PostgreSql. When i try to access a
> database which is on the server using
> DriverManager.getConnection("jdbc:postgresql://host:port/banco","user",
> "password"); an error occurs:"User authentication failed". Where do i
> configure users and passwords for my database in the Postgresql?
[ someone correct me as I can't confirm this yet (as I would normally do
when writing SQL) as I still yet to get postgres back up and running since
last weeks accident ]
If you log into the database as the DBA (usually postgres), you can then
create a normal user using a statement like:
mydb> CREATE USER peter WITH PASSWORD mypass ;
you can change their passwords with:
mydb> ALTER USER peter WITH PASSWORD mypass ;
Now once you have done that, you need to configure the pg_hba.conf file
(located in the PG_DATA directory). You will need to create an entry for
each database (or all for all of them) to allow remote clients access.
eg:
# This allows hosts on the 192.168.4.0 network access to all databases
host all 192.168.4.0 255.255.255.0 crypt
# This allows a single host access to the test database
host test 192.168.4.2 255.255.255.255 crypt
Hope that helps
--
Peter T Mount peter(at)retep(dot)org(dot)uk or petermount(at)earthling(dot)net
Main Homepage: http://www.retep.org.uk
Postgresql JDBC Faq is available at http://www.retep.org.uk/postgres
From | Date | Subject | |
---|---|---|---|
Next Message | Len Morgan | 1998-07-09 17:50:11 | ODBC Problem |
Previous Message | Peter T Mount | 1998-07-09 17:04:52 | Re: [INTERFACES] a JDBC applet |