Thread: problem connecting from JDBC

problem connecting from JDBC

From
"Ravi Kanth"
Date:
Hi,
I am trying to access postgresql database (7.3.2 - that came by default with
RedHat Linux 9 distro) using JDBC. I have a Linux user called "oracle" that
I have created in postgresql also and gave that user privileges to create a
database.
I tried to create a databse using createdb and it works.
The url that I am using in JDBC is: "jdbc:postgresql://localhost:5432/test",
"oracle", "". It reverts bck with error that says:
SQLException: Connection refused. Check that the hostname and port are
correct and that the postmaster is accepting TCP/IP connections.
I am using JDK 1.4.2 and NetBeans IDE.
Can anyone plz help? Thanks.

Ravi.

_________________________________________________________________
Compare high-speed Internet plans, starting at $26.95.
https://broadband.msn.com (Prices may vary by service area.)


Re: problem connecting from JDBC

From
pginfo
Date:
Hi,

Pls.check if you have in your postgresql.conf  set  tcpip_socket = true.
I am using pg 7.3.4 + rh 9.0 + jdbc without any problems.
Also as beginning you can make the pg trusted to you ip (I think it is trusted
by default to localhost).
Have you created database with name "test"?

regards,
ivan.



Ravi Kanth wrote:

> Hi,
> I am trying to access postgresql database (7.3.2 - that came by default with
> RedHat Linux 9 distro) using JDBC. I have a Linux user called "oracle" that
> I have created in postgresql also and gave that user privileges to create a
> database.
> I tried to create a databse using createdb and it works.
> The url that I am using in JDBC is: "jdbc:postgresql://localhost:5432/test",
> "oracle", "". It reverts bck with error that says:
> SQLException: Connection refused. Check that the hostname and port are
> correct and that the postmaster is accepting TCP/IP connections.
> I am using JDK 1.4.2 and NetBeans IDE.
> Can anyone plz help? Thanks.
>
> Ravi.
>
> _________________________________________________________________
> Compare high-speed Internet plans, starting at $26.95.
> https://broadband.msn.com (Prices may vary by service area.)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match




Re: problem connecting from JDBC

From
"Nick Fankhauser"
Date:
Ravi-

I'd suggest checking in postgresql.conf to make sure tcpip_socket is set to
on & also check pg_hba.conf to make sure the authorization info is set up to
allow local connections.

Take a look here for a more complete explanation:

http://www.fankhausers.com/postgresql/jdbc/welcome.html#tcpip


-Nick

> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Ravi Kanth
> Sent: Monday, November 10, 2003 11:44 AM
> To: pgsql-jdbc@postgresql.org
> Subject: [JDBC] problem connecting from JDBC
>
>
> Hi,
> I am trying to access postgresql database (7.3.2 - that came by
> default with
> RedHat Linux 9 distro) using JDBC. I have a Linux user called
> "oracle" that
> I have created in postgresql also and gave that user privileges
> to create a
> database.
> I tried to create a databse using createdb and it works.
> The url that I am using in JDBC is:
> "jdbc:postgresql://localhost:5432/test",
> "oracle", "". It reverts bck with error that says:
> SQLException: Connection refused. Check that the hostname and port are
> correct and that the postmaster is accepting TCP/IP connections.
> I am using JDK 1.4.2 and NetBeans IDE.
> Can anyone plz help? Thanks.
>
> Ravi.
>
> _________________________________________________________________
> Compare high-speed Internet plans, starting at $26.95.
> https://broadband.msn.com (Prices may vary by service area.)
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>



Re: problem connecting from JDBC

From
"Ravi Kanth"
Date:
Hi,
I did set the tcp/ip socket value to true in postgresql.conf. And I added
the line:
host all 127.0.0.1 255.0.0.0 trust
to pg_hba.conf file. This file already had the line:
local all all ident sameuser
I left it as it is. Now it shows me the error:
Missing or erroneous pg_hba.conf file

Thanks,
Ravi.



>From: "Nick Fankhauser" <nickf@ontko.com>
>Reply-To: <nickf@ontko.com>
>To: "Ravi Kanth" <ravi_kanth@msn.com>, <pgsql-jdbc@postgresql.org>
>Subject: Re: [JDBC] problem connecting from JDBC
>Date: Mon, 10 Nov 2003 12:29:03 -0500
>
>Ravi-
>
>I'd suggest checking in postgresql.conf to make sure tcpip_socket is set to
>on & also check pg_hba.conf to make sure the authorization info is set up
>to
>allow local connections.
>
>Take a look here for a more complete explanation:
>
>http://www.fankhausers.com/postgresql/jdbc/welcome.html#tcpip
>
>
>-Nick
>
> > -----Original Message-----
> > From: pgsql-jdbc-owner@postgresql.org
> > [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Ravi Kanth
> > Sent: Monday, November 10, 2003 11:44 AM
> > To: pgsql-jdbc@postgresql.org
> > Subject: [JDBC] problem connecting from JDBC
> >
> >
> > Hi,
> > I am trying to access postgresql database (7.3.2 - that came by
> > default with
> > RedHat Linux 9 distro) using JDBC. I have a Linux user called
> > "oracle" that
> > I have created in postgresql also and gave that user privileges
> > to create a
> > database.
> > I tried to create a databse using createdb and it works.
> > The url that I am using in JDBC is:
> > "jdbc:postgresql://localhost:5432/test",
> > "oracle", "". It reverts bck with error that says:
> > SQLException: Connection refused. Check that the hostname and port are
> > correct and that the postmaster is accepting TCP/IP connections.
> > I am using JDK 1.4.2 and NetBeans IDE.
> > Can anyone plz help? Thanks.
> >
> > Ravi.
> >
> > _________________________________________________________________
> > Compare high-speed Internet plans, starting at $26.95.
> > https://broadband.msn.com (Prices may vary by service area.)
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 9: the planner will ignore your desire to choose an index scan if
>your
> >       joining column's datatypes do not match
> >
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

_________________________________________________________________
Send a QuickGreet with MSN Messenger
http://www.msnmessenger-download.com/tracking/cdp_games


Re: problem connecting from JDBC

From
"Nick Fankhauser"
Date:
Hello Ravi-

I'm Sorry! I think I need to update this section of the FAQ... There is now
an additional parameter for the remote connections. Try one of these:

host    all         all         127.0.0.1        255.0.0.0        trust

or

host    all         all         127.0.0.1        255.0.0.0        ident
sameuser

The "local all all ident sameuser" line doesn't help you because JDBC uses a
netwook connection, even if it is on the same machine. The "local" auth line
controls client using unix sockets such as psql.

I hope this helps.

-Nick


> -----Original Message-----
> From: Ravi Kanth [mailto:ravi_kanth@msn.com]
> Sent: Monday, November 10, 2003 1:23 PM
> To: nickf@ontko.com
> Cc: pgsql-jdbc@postgresql.org; pginfo@t1.unisoftbg.com
> Subject: Re: [JDBC] problem connecting from JDBC
>
>
> Hi,
> I did set the tcp/ip socket value to true in postgresql.conf. And I added
> the line:
> host all 127.0.0.1 255.0.0.0 trust
> to pg_hba.conf file. This file already had the line:
> local all all ident sameuser
> I left it as it is. Now it shows me the error:
> Missing or erroneous pg_hba.conf file
>
> Thanks,
> Ravi.
>
>
>
> >From: "Nick Fankhauser" <nickf@ontko.com>
> >Reply-To: <nickf@ontko.com>
> >To: "Ravi Kanth" <ravi_kanth@msn.com>, <pgsql-jdbc@postgresql.org>
> >Subject: Re: [JDBC] problem connecting from JDBC
> >Date: Mon, 10 Nov 2003 12:29:03 -0500
> >
> >Ravi-
> >
> >I'd suggest checking in postgresql.conf to make sure
> tcpip_socket is set to
> >on & also check pg_hba.conf to make sure the authorization info
> is set up
> >to
> >allow local connections.
> >
> >Take a look here for a more complete explanation:
> >
> >http://www.fankhausers.com/postgresql/jdbc/welcome.html#tcpip
> >
> >
> >-Nick
> >
> > > -----Original Message-----
> > > From: pgsql-jdbc-owner@postgresql.org
> > > [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Ravi Kanth
> > > Sent: Monday, November 10, 2003 11:44 AM
> > > To: pgsql-jdbc@postgresql.org
> > > Subject: [JDBC] problem connecting from JDBC
> > >
> > >
> > > Hi,
> > > I am trying to access postgresql database (7.3.2 - that came by
> > > default with
> > > RedHat Linux 9 distro) using JDBC. I have a Linux user called
> > > "oracle" that
> > > I have created in postgresql also and gave that user privileges
> > > to create a
> > > database.
> > > I tried to create a databse using createdb and it works.
> > > The url that I am using in JDBC is:
> > > "jdbc:postgresql://localhost:5432/test",
> > > "oracle", "". It reverts bck with error that says:
> > > SQLException: Connection refused. Check that the hostname and port are
> > > correct and that the postmaster is accepting TCP/IP connections.
> > > I am using JDK 1.4.2 and NetBeans IDE.
> > > Can anyone plz help? Thanks.
> > >
> > > Ravi.
> > >
> > > _________________________________________________________________
> > > Compare high-speed Internet plans, starting at $26.95.
> > > https://broadband.msn.com (Prices may vary by service area.)
> > >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 9: the planner will ignore your desire to choose an index scan if
> >your
> > >       joining column's datatypes do not match
> > >
> >
> >
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
> _________________________________________________________________
> Send a QuickGreet with MSN Messenger
> http://www.msnmessenger-download.com/tracking/cdp_games
>



Re: problem connecting from JDBC

From
"Ravi Kanth"
Date:
Thanks everyone....its working now.

Ravi.

_________________________________________________________________
From Beethoven to the Rolling Stones, your favorite music is always playing
on MSN Radio Plus. No ads, no talk. Trial month FREE!
http://join.msn.com/?page=offers/premiumradio