Thread: Problem connecting to PostgreSQL on Debian Linux

Problem connecting to PostgreSQL on Debian Linux

From
Jeff Self
Date:
I've written a JSP that extracts data from a PostgreSQL database and
displays it in a web browser. I tested this on my iBook which is running
OS X 10.2, PostgreSQL 7.2.3, Tomcat 4.1.12, and Java 1.3.1. It runs
fine. So I copied the app over to my server which is running Debian
Linux 3.0, PostgreSQL 7.2.2, Tomcat 4.1.12, and Blackdown Java 1.3.1.
But I can't connect to the database on the Debian box.

Here's some of my settings on the Debian box:

Postgresql.conf
    tcpip_socket=1

Pg_hba.conf
    host    all    127.0.0.1    255.255.255.255    ident sameuser

I've tried to connect writing a little java app to run from the command
line, but it fails: IDENT authentication failed for user "jself"

Here's some of my code:
    Class.forName("org.postgresql.Driver");
    Connection conn = DriverManager.getConnection(
        "jdbc:postgresql:jobdescriptions",
        "jself"
        ""
    );

I've downloaded the pgjdbc2.jar file from jdbc.postgresql.org and put it
in /usr/share/tomcat4/common/lib.

I run my java app the following way: java -classpath
/usr/share/tomcat4/common/lib/pgjdbc2.jar:. QueryJobDescriptions

Is my pg_hba.conf file wrong?

jself is the owner of the jobdescriptions database and has no password

--
Jeff Self
Information Technology Analyst
City of Newport News
Personnel Department Suite 200
700 Town Center Drive
Newport News, VA 23606
757-926-1810


Re: Problem connecting to PostgreSQL on Debian Linux

From
Hans-Jürgen Schönig
Date:
Did you enable TCP/IP when starting PostgreSQL?

pg_ctl -D anydir -o "-i" -l logfile start

    Hans



Jeff Self wrote:

>I've written a JSP that extracts data from a PostgreSQL database and
>displays it in a web browser. I tested this on my iBook which is running
>OS X 10.2, PostgreSQL 7.2.3, Tomcat 4.1.12, and Java 1.3.1. It runs
>fine. So I copied the app over to my server which is running Debian
>Linux 3.0, PostgreSQL 7.2.2, Tomcat 4.1.12, and Blackdown Java 1.3.1.
>But I can't connect to the database on the Debian box.
>
>Here's some of my settings on the Debian box:
>
>Postgresql.conf
>    tcpip_socket=1
>
>Pg_hba.conf
>    host    all    127.0.0.1    255.255.255.255    ident sameuser
>
>I've tried to connect writing a little java app to run from the command
>line, but it fails: IDENT authentication failed for user "jself"
>
>Here's some of my code:
>    Class.forName("org.postgresql.Driver");
>    Connection conn = DriverManager.getConnection(
>        "jdbc:postgresql:jobdescriptions",
>        "jself"
>        ""
>    );
>
>I've downloaded the pgjdbc2.jar file from jdbc.postgresql.org and put it
>in /usr/share/tomcat4/common/lib.
>
>I run my java app the following way: java -classpath
>/usr/share/tomcat4/common/lib/pgjdbc2.jar:. QueryJobDescriptions
>
>Is my pg_hba.conf file wrong?
>
>jself is the owner of the jobdescriptions database and has no password
>
>
>


--
*Cybertec Geschwinde u Schoenig*
Ludo-Hartmannplatz 1/14, A-1160 Vienna, Austria
Tel: +43/1/913 68 09; +43/664/233 90 75
www.postgresql.at <http://www.postgresql.at>, cluster.postgresql.at
<http://cluster.postgresql.at>, www.cybertec.at
<http://www.cybertec.at>, kernel.cybertec.at <http://kernel.cybertec.at>



Re: Problem connecting to PostgreSQL on Debian Linux

From
Daniel Serodio
Date:
Try replacing "ident sameuser" with "trust" in pg_hba.conf

On Fri, 2002-10-25 at 12:22, Jeff Self wrote:
> I've written a JSP that extracts data from a PostgreSQL database and
> displays it in a web browser. I tested this on my iBook which is running
> OS X 10.2, PostgreSQL 7.2.3, Tomcat 4.1.12, and Java 1.3.1. It runs
> fine. So I copied the app over to my server which is running Debian
> Linux 3.0, PostgreSQL 7.2.2, Tomcat 4.1.12, and Blackdown Java 1.3.1.
> But I can't connect to the database on the Debian box.
>
> Here's some of my settings on the Debian box:
>
> Postgresql.conf
>     tcpip_socket=1
>
> Pg_hba.conf
>     host    all    127.0.0.1    255.255.255.255    ident sameuser
>
> I've tried to connect writing a little java app to run from the command
> line, but it fails: IDENT authentication failed for user "jself"
>
> Here's some of my code:
>     Class.forName("org.postgresql.Driver");
>     Connection conn = DriverManager.getConnection(
>         "jdbc:postgresql:jobdescriptions",
>         "jself"
>         ""
>     );
>
> I've downloaded the pgjdbc2.jar file from jdbc.postgresql.org and put it
> in /usr/share/tomcat4/common/lib.
>
> I run my java app the following way: java -classpath
> /usr/share/tomcat4/common/lib/pgjdbc2.jar:. QueryJobDescriptions
>
> Is my pg_hba.conf file wrong?
>
> jself is the owner of the jobdescriptions database and has no password
>
> --
> Jeff Self
> Information Technology Analyst
> City of Newport News
> Personnel Department Suite 200
> 700 Town Center Drive
> Newport News, VA 23606
> 757-926-1810
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
[]'s
Daniel Serodio


Re: Problem connecting to PostgreSQL on Debian Linux

From
Tony Grant
Date:
On Fri, 2002-10-25 at 17:22, Jeff Self wrote:

> I've tried to connect writing a little java app to run from the command
> line, but it fails: IDENT authentication failed for user "jself"

Try giving access to the database from the tomcat4 user

Cheers

Tony Grant

--
www.tgds.net
Library management software toolkit, redhat linux on Sony Vaio C1XD,
Dreamweaver MX with Tomcat and PostgreSQL