aspose file tools
The moose likes JDBC and Relational Databases and the fly likes How to get Password value from Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to get Password value from Connection" Watch "How to get Password value from Connection" New topic

How to get Password value from Connection

Ram Chhabra
Ranch Hand

Joined: Jan 07, 2008
Posts: 48

As per my code, i am connected to database successfully.
Suppose i am having my connection object as con.

Now, i just want some information about that connection in java code. I am able to get the url and username by the below code:

But i am not able to fetch the value of password. Can you please tell me that how to get the value of password, which connection is using?

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 41576
Do a search through this forum; a similar topic came up about two weeks ago.
I think we concluded it is impossible to extract a password with simple SQL.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31668

In the discussion Campbell refers to, we had some back and forth about why one would need the password. If you say what you are trying to accomplish, someone might be able to give you an alternate approach.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
You are not able to do this because the API doesnt allow it - being able to do so would pose a security risk to the associated application.

I presume you have the password already otherwise you wouldnt be able to connect in your code?
jQuery in Action, 2nd edition
subject: How to get Password value from Connection