Thread: Using the JDBC Driver - users: Permission Denied

Using the JDBC Driver - users: Permission Denied

From
Hunter Hillegas
Date:
I am working on my first PostgreSQL application using Java... I'm previously
a mySQL user... I am running 7.1 beta4.

Anyway, I got everything installed and to the point that my JSP is trying to
access the database...

When I try to make the Connection call, I get this error message:

java.sql.SQLException: ERROR: users: Permission denied.

I created a user called 'test' using the 'createuser' program. I am trying
to connect as this user without a password. The servlet engine is on the
same machine as the database.

I have not modified pg_hba.conf file at all.

There must be a permissions thing but I don't know what it is. The database
was not created as this user... Is that the problem? If so, how do I change
the ownership over to the newer user.

I looked in Bruce's book but I'm still having trouble.

Any help is appreciated. Thanks.

Hunter
--
Hunter Hillegas
hunter@lastonepicked.com


Re: Using the JDBC Driver - users: Permission Denied

From
Peter Mount
Date:
At 10:49 07/02/01 -0800, Hunter Hillegas wrote:
>I am working on my first PostgreSQL application using Java... I'm previously
>a mySQL user... I am running 7.1 beta4.
>
>Anyway, I got everything installed and to the point that my JSP is trying to
>access the database...
>
>When I try to make the Connection call, I get this error message:
>
>java.sql.SQLException: ERROR: users: Permission denied.

Have you granted permission to the account your servlet is connecting as?


>I created a user called 'test' using the 'createuser' program. I am trying
>to connect as this user without a password. The servlet engine is on the
>same machine as the database.
>
>I have not modified pg_hba.conf file at all.

Should work...


>There must be a permissions thing but I don't know what it is. The database
>was not created as this user... Is that the problem? If so, how do I change
>the ownership over to the newer user.

atleast do: GRANT SELECT ON table TO user ;


>I looked in Bruce's book but I'm still having trouble.
>
>Any help is appreciated. Thanks.
>
>Hunter
>--
>Hunter Hillegas
>hunter@lastonepicked.com


Re: Using the JDBC Driver - users: Permission Denied

From
Hunter Hillegas
Date:
I hadn't done the grant...

I just ran the following:

GRANT SELECT ON groundswell-test TO testDbLogin

and there was no error message or anything like that from psql.

Still, when trying to hit the servlet, I get the same message regarding
permission denied.

I must be doing something wrong...

My machine has many virtual IP addresses (but just one NIC). Is it possible
it's trying to connect from something other than localhost? Is there anyway
to check this?

I'm using this connect URL: jdbc:postgresql:groundswell-test

Postmaster is running with the '-I' flag on.

Anyway, I'm running Sun JDK1.3 on RedHat Linux 6.1/Intel.

I must be doing something wrong, I just can't figure it out.
--
Hunter Hillegas
hunter@lastonepicked.com

> From: Peter Mount <peter@retep.org.uk>
> Date: Wed, 07 Feb 2001 22:13:25 +0000
> To: Hunter Hillegas <hunter@lastonepicked.com>, PostgreSQL
> <pgsql-general@postgresql.org>
> Subject: Re: [GENERAL] Using the JDBC Driver - users: Permission Denied
>
> At 10:49 07/02/01 -0800, Hunter Hillegas wrote:
>> I am working on my first PostgreSQL application using Java... I'm previously
>> a mySQL user... I am running 7.1 beta4.
>>
>> Anyway, I got everything installed and to the point that my JSP is trying to
>> access the database...
>>
>> When I try to make the Connection call, I get this error message:
>>
>> java.sql.SQLException: ERROR: users: Permission denied.
>
> Have you granted permission to the account your servlet is connecting as?
>
>
>> I created a user called 'test' using the 'createuser' program. I am trying
>> to connect as this user without a password. The servlet engine is on the
>> same machine as the database.
>>
>> I have not modified pg_hba.conf file at all.
>
> Should work...
>
>
>> There must be a permissions thing but I don't know what it is. The database
>> was not created as this user... Is that the problem? If so, how do I change
>> the ownership over to the newer user.
>
> atleast do: GRANT SELECT ON table TO user ;
>
>
>> I looked in Bruce's book but I'm still having trouble.
>>
>> Any help is appreciated. Thanks.
>>
>> Hunter
>> --
>> Hunter Hillegas
>> hunter@lastonepicked.com
>


Re: Using the JDBC Driver - users: Permission Denied

From
earnestch@netscape.net (Earnest)
Date:
Apart from the grant db/table access right to dividual db user, you
have to modify the pg_hba.conf to grant the connection right for
specific IP to access postgresql database.

Before you try to apply the security checking,
try to do the connection with trust(no password required) first.

At the end of the pg_hba.conf, add the following line

host         test      192.168.1.0    255.255.255.0       trust


This will make all host with the IP 192.168.1.* to access the "test" db without
password.

Once this is okay, you can replace it with the following line :

host         test      192.168.1.0    255.255.255.0       crypt


In order to enable the password checking, you have to enter the passwd for the
account in the "pg_shadow" System table.

List all System table :
\dS

List the content of "pg_shadow":

select * from pg_shadow;
------------+---------
usename     | testuser
usesysid    | 27
usecreatedb | t
usetrace    | f
usesuper    | f
usecatupd   | f
passwd      | test123
valuntil    |
------------+---------


Hope this can help you.


peter@retep.org.uk (Peter Mount) wrote in
<5.0.2.1.0.20010207221117.00a65e60@mail.retep.org.uk>:

>At 10:49 07/02/01 -0800, Hunter Hillegas wrote:
>>I am working on my first PostgreSQL application using Java... I'm
>>previously a mySQL user... I am running 7.1 beta4.
>>
>>Anyway, I got everything installed and to the point that my JSP is
>>trying to access the database...
>>
>>When I try to make the Connection call, I get this error message:
>>
>>java.sql.SQLException: ERROR: users: Permission denied.
>
>Have you granted permission to the account your servlet is connecting
>as?
>
>
>>I created a user called 'test' using the 'createuser' program. I am
>>trying to connect as this user without a password. The servlet engine
>>is on the same machine as the database.
>>
>>I have not modified pg_hba.conf file at all.
>
>Should work...
>
>
>>There must be a permissions thing but I don't know what it is. The
>>database was not created as this user... Is that the problem? If so,
>>how do I change the ownership over to the newer user.
>
>atleast do: GRANT SELECT ON table TO user ;
>
>
>>I looked in Bruce's book but I'm still having trouble.
>>
>>Any help is appreciated. Thanks.
>>
>>Hunter
>>--
>>Hunter Hillegas
>>hunter@lastonepicked.com
>