Обсуждение: Any example code of using passwords with JDBC?

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

Any example code of using passwords with JDBC?

От
David Siebert
Дата:
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?

Re: Any example code of using passwords with JDBC?

От
Dave Cramer
Дата:
David,

I use passwords all the time,

Can you create a small test case which fails ?

Dave
On 14-Jun-05, at 11:07 AM, David Siebert wrote:

> 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?
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>
>


Re: Any example code of using passwords with JDBC?

От
Roland Walter
Дата:
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.
------------------------------------------------------