Обсуждение: Question about jdbc

Поиск
Список
Период
Сортировка

Question about jdbc

От
Natali Kolker
Дата:
Hi,


I compiled JDBC  sources ,  that comes with version  6.3 .

When I  am trying to connect to  data base ,

"DriverManager.getConnection("jdbc:postgresql://haver:5432/natali",
"natali", "Elina);"
I got a response:


>
> java.sql.SQLException: User authentication failed
>         at java.lang.Throwable.<init>(Compiled Code)
>         at java.lang.Exception.<init>(Compiled Code)
>         at java.sql.SQLException.<init>(Compiled Code)
>         at postgresql.Connection.<init>(Compiled Code)
>         at postgresql.Driver.connect(Compiled Code)
>         at java.sql.DriverManager.getConnection(Compiled Code)
>         at java.sql.DriverManager.getConnection(Compiled Code)
>         at db.init_database(Compiled Code)
>         at db.main(Compiled Code)
>
My jdbc drivers in dir $CLASSPATH/postgresql,
I created my database with command:
createdb -u natali
Username : natali,
Password: Elina

In perl   I write : $conn = Pg::connectdb("dbname = natali");,
and I have connection.

If somebody can help me , with my  " authentification" problem , I would
really  appriciate it.

Natali Kolker
--

--------------------------------------------------------------------
Natali Kolker
Dept of Molecular Biotechnology, Box 357730   Tel: +1-206-685-7334
University of Washington School of Medicine   Fax: +1-206-685-7301
Seattle, WA 98195-7730, USA                   natali@u.washington.edu



Re: [GENERAL] Question about jdbc

От
Peter Mount
Дата:
On Fri, 12 Jun 1998, Natali Kolker wrote:

> I compiled JDBC  sources ,  that comes with version  6.3 .

If possible, upgrade to 6.3.2, as it has a more fuller JDBC
implementation, and fewer bugs.

> When I  am trying to connect to  data base ,
>
> "DriverManager.getConnection("jdbc:postgresql://haver:5432/natali",
> "natali", "Elina);"
> I got a response:
> >
> > java.sql.SQLException: User authentication failed

What do you have set in your pg_hba.conf file?

> My jdbc drivers in dir $CLASSPATH/postgresql,
> I created my database with command:
> createdb -u natali
> Username : natali,
> Password: Elina
>
> In perl   I write : $conn = Pg::connectdb("dbname = natali");,
> and I have connection.
>
> If somebody can help me , with my  " authentification" problem , I would
> really  appriciate it.

JDBC only works using TCP/IP, but (someone correct me if I'm wrong), the
Perl interface can use Unix domain sockets, so if you have a different
setting in pg_hba.conf, it can cause the fact that perl can connect, but
JDBC not.

Also, if you defined pg_hba.conf to use password or crypt authentication,
ensure you have defined the user in the database, AND a password. A blank
password doesn't work.

Postgresql-JDBC FAQ: http://www.retep.org.uk/postgres

--
Peter T Mount peter@retep.org.uk or petermount@earthling.net
Main Homepage: http://www.retep.org.uk
************ Someday I may rebuild this signature completely ;-) ************
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk