This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to get Password value from Connection" Watch "How to get Password value from Connection" New topic
Author

How to get Password value from Connection

Ram Chhabra
Ranch Hand

Joined: Jan 07, 2008
Posts: 48
Hi,

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?

Thanks,
Ram
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Ram,
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.


[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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get Password value from Connection
 
Similar Threads
Trouble connecting to MS Access via ODBC
@Resource injection not working for DataSource
how to send user credentials to a protected restful webservice
How to get Browser Variable value in side JSTL
Where to write Validation