File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
How to get Password value from Connection
Joined: Jan 07, 2008
Oct 20, 2008 05:40:00
As per my code, i am connected to database successfully.
Suppose i am having my connection object as
Now, i just want some information about that connection in
code. I am able to get the url and username by the below code:
DatabaseMetaData metadata = con.getMetaData(); System.out.println("URL ---- "+metadata.getURL()); System.out.println("Username ---- "+metadata.getUserName());
But i am not able to fetch the value of
. Can you please tell me that how to get the value of password, which connection is using?
Joined: Oct 13, 2005
Oct 20, 2008 05:56:00
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.
author & internet detective
Joined: May 26, 2003
Oct 20, 2008 17:41:00
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
How To Ask Questions The Smart Way
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
Joined: Aug 17, 2006
Oct 23, 2008 19:20:00
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:
subject: How to get Password value from Connection
How to get Browser Variable value in side JSTL
how to send user credentials to a protected restful webservice
@Resource injection not working for DataSource
Where to write Validation
Trouble connecting to MS Access via ODBC
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015