Unix Technical Forum

Any example code of using passwords with JDBC?

This is a discussion on Any example code of using passwords with JDBC? within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> I have yet to figure out how to access a postgres server that requires passwords. I can log onto ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 11:20 PM
David Siebert
 
Posts: n/a
Default Any example code of using passwords with JDBC?

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 11:20 PM
Dave Cramer
 
Posts: n/a
Default Re: Any example code of using passwords with JDBC?

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



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-15-2008, 11:20 PM
Roland Walter
 
Posts: n/a
Default Re: Any example code of using passwords with 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.
------------------------------------------------------


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com