Re: Any example code of using passwords with JDBC?

From: Roland Walter <rwa(at)mosaic-ag(dot)com>
To: david(at)eclipsecat(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Any example code of using passwords with JDBC?
Date: 2005-06-14 15:38:32
Message-ID: 42AEF9F8.1060608@mosaic-ag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

David Siebert schrieb:

> I have yet to figure out how to access a postgres server that requires
> passwords. I can log onto it with PG adminIII just fine but not using JDBC.
> Here is my connect statement
> m_sqlConnection = DriverManager.getConnection(s_SQLConnect,
> s_SQLUser,"PASSWORD");
> I have tried clear text, md5, and encrypted.
> Does JDBC detect what type of password is required and then sends it?
> Or do I have to specify it somewhere?

I use md5 in pg_hba.conf.

The JDBC-Driver seems to know, what to send, as I use only
the statement you have given above to get a connection.

Creating a user with

CREATE USER user1 WITH PASSWORD 'secret';

gives a user1 with an encrypted password, that is
md5 encrypted by default.

--
Roland Walter
MOSAIC SOFTWARE AG
Telefon: 02225/882-411 Fax: 02225/882-201
http://www.mosaic-ag.com
------- L E G A L D I S C L A I M E R ---------

Die Informationen in dieser Nachricht sind vertraulich
und ausschliesslich fuer den Adressaten bestimmt.
Kenntnisnahme durch Dritte ist unzulaessig. Die
Erstellung von Kopien oder das Weiterleiten an weitere,
nicht originaere und benannte Adressaten ist nicht
vorgesehen und kann ungesetzlich sein. Die Meinungen
in dieser Nachricht stellen lediglich die Meinungen
des Senders dar. Falls Sie vermuten, dass diese
Nachricht veraendert wurde, setzen Sie sich mit dem
Absender in Verbindung. Der Absender uebernimmt ohne
weitere Ueberpruefung keine Verantwortung fuer die
Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte
Empfaenger werden gebeten, die Vertraulichkeit der
Nachricht zu wahren und den Absender sofort ueber
einen Uebertragungsfehler zu informieren.
------------------------------------------------------

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-06-14 16:12:56 Re: New italian translation
Previous Message Dave Cramer 2005-06-14 15:20:08 patch for passing the cts