mysql - How to retrieve the password from a java.sql.Connection object -
i'm looking way password java.sql.connection object. know there's getusername() method in databasemetadata object, unfortunately no corresponding getpassword() method. using debugger in netbeans can see field password, there must way information using reflection, far i've been unable figure out how.
as commented, way must looking code. instance, mysql using latest driver (5.1.15). can password this:
public static void main(string[] args) throws exception{ connectionimpl con = (connectionimpl) drivermanager.getconnection("jdbc:mysql://localhost:3908/mydb?user=edalorzo&password=mandrake"); system.out.println(con.getproperties().get("password")); con.close(); } but this, need know class hierarchy , implementation details.
other databases different. if database open source, mysql can know details of inner construction , find ways retrieve password.
Comments
Post a Comment