I want to encrypt/hide my connection string in my database.java class. I allready searched the internet but I didn’t find anything usefull, maybe I searched the wrong keywords? Here is my current code.
conn = DriverManager.getConnection("jdbc:mysql://database/db", "username", "password");
How can I hide the username and password? So only my application can see it? And you can’t see it when you extract the jar?
Thanks.
Encrypt the connection string is not what you need! I suppose you need a better way to store your password. For this you should store passwords, in a separate file that the application reads when it starts. That is the only real way to prevent the password from leaking as a result of decompilation.
See this answer : From a similar question