473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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:
Stack Trace: 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.


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

Nov 22 '05 #1
2 2160
Phil Campaigne wrote:
my psql client I type psql and then I am asked for my password. This
logs me into my hosted database just fine.
Ok. This is probably localhost, 127.0.0.1 and the username defaults
to your login name.
However, I can't log on from my webapp to the database thru jdbc like I

---------8<---------
>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.


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

Nov 22 '05 #2

On 03/02/2004 15:45 Phil Campaigne wrote:
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:
Stack Trace:

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.


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?

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 ma*******@postgresql.org

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sridhar nagabhurshana | last post by:
hello I am trying to connect to mysql database using connector/J jdbc driver this is my code import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException;
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
10
by: sssk28 | last post by:
i have installed fedora core 6 and i am getting following error: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this...
2
by: dmstn | last post by:
Hey! I've got a little problem. I have to make a web site for a university essay. I curently have to create a search engine. Users can enter a hotel name in a search bar and results have to appear in...
1
by: manjava | last post by:
Hello, i have a class java conncet to database mysql when i execute the classe alone so execute but when i want to execute this link on web...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.