Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 22nd, 2005, 08:50 AM
Phil Campaigne
Guest
 
Posts: n/a
Default problem with jdbc connection to postgesql

Hi All,
I am seting up my web app with a tomcat/postgresql hosting service.
From my psql client I type psql and then I am asked for my password.
This logs me into my hosted database just fine.

However, I can't log on from my webapp to the database thru jdbc like I
could when my webapp/Tomcat/postgresql were on my local machine. The
jdbc class only has a method with 3 parameters, url, user, password
parameters. The hosting server is giving me the following error message:[color=blue]
>Stack Trace:[/color]
[color=blue]
>java.sql.SQLException: FATAL 1: Password authentication failed for
>user "xxxxxx"[/color]
[color=blue]
>So, it looks like it is trying to connect using username xxxxxx,
>not password yyyyyy.[/color]

I'm using the DriverManager.getConnection(url, user, password) method in
my connection class.

jdbc:postgresql://database.domain.org/databasename

username: xxxxxx
password: yyyyyy

It seems to be confused by the presence of the extra parameter 'user'.
I believe that the postgresql database wants just the password. How do I
give it just the url and password. There is no getConnection method on
the DriverManager classd with just url and password?

Has anyone else experienced this problem? Any ideas?
thanks,
Phil


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster




  #2  
Old November 22nd, 2005, 08:50 AM
Dirk Försterling
Guest
 
Posts: n/a
Default Re: problem with jdbc connection to postgesql

Phil Campaigne wrote:[color=blue]
> my psql client I type psql and then I am asked for my password. This
> logs me into my hosted database just fine.[/color]

Ok. This is probably localhost, 127.0.0.1 and the username defaults
to your login name.
[color=blue]
> However, I can't log on from my webapp to the database thru jdbc like I[/color]
---------8<---------[color=blue][color=green]
> >java.sql.SQLException: FATAL 1: Password authentication failed for
> >user "xxxxxx"
> >So, it looks like it is trying to connect using username xxxxxx,
> >not password yyyyyy.[/color][/color]

I don't think so. What happens if you try using your login name as
username?

-dirk

--
D i r k F "o r s t e r l i n g
r@zorbla.de http://r@zorbla.de/
-------------
This is robbery-mail(tm). Reply all your money immediately!


---------------------------(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

  #3  
Old November 22nd, 2005, 08:50 AM
Paul Thomas
Guest
 
Posts: n/a
Default Re: problem with jdbc connection to postgesql


On 03/02/2004 15:45 Phil Campaigne wrote:[color=blue]
> Hi All,
> I am seting up my web app with a tomcat/postgresql hosting service. From
> my psql client I type psql and then I am asked for my password. This
> logs me into my hosted database just fine.
>
> However, I can't log on from my webapp to the database thru jdbc like I
> could when my webapp/Tomcat/postgresql were on my local machine. The
> jdbc class only has a method with 3 parameters, url, user, password
> parameters. The hosting server is giving me the following error message:[color=green]
> >Stack Trace:[/color]
>[color=green]
> >java.sql.SQLException: FATAL 1: Password authentication failed[/color]
> for >user "xxxxxx"
>[color=green]
> >So, it looks like it is trying to connect using username xxxxxx,
> >not password yyyyyy.[/color]
>
> I'm using the DriverManager.getConnection(url, user, password) method in
> my connection class.
>
> jdbc:postgresql://database.domain.org/databasename
>
> username: xxxxxx
> password: yyyyyy
>
> It seems to be confused by the presence of the extra parameter 'user'. I
> believe that the postgresql database wants just the password. How do I
> give it just the url and password. There is no getConnection method on
> the DriverManager classd with just url and password?
>
> Has anyone else experienced this problem? Any ideas?[/color]


Well obviously you can't have a password without a user which why there is
no such method signature. Make sure that:

a) the postmaster is listening on tcp/ip port 5432 (it looks like it else
you would probably get a connect failure)

b) your user is allowed to connect to the database using tcp/ip (check
pg_hba.conf)

c) you are using the correct password for the user.


--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.