0

I have to develop a Java 8 SE application that read data from a DB. I need to connect to the DB via username and password. I don't want put the username and password in clear on my application. How can I do this? Is there some example where I can find some solution. This is the first time I do this, so I would want find a good solution.

My application is not distibuited. It is a desktop application that I have to use for internal project. It couldn't go on internet. The Db is on another machine and so I have to connect to it with username and password. I would want avod to insert in my code username and password in clear and so I'm finding a way to do this better...

I run this application from my computer.

I hope to have been more clear.

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • Are you distributing your app to clients? If that's the case, is the frontend accessing the database directly? Is the database deployed on their machine? Please [edit] your question providing some more detail on your architecture, because the answer may *heavily* depend on that. – Federico klez Culloca Mar 09 '22 at 10:51
  • 1
    You can't really. That's one main reason why databases are server-side. The best you can do is make the user log in each time and don't store the password at all (apart from on the db server) – g00se Mar 09 '22 at 10:51
  • This question seems to come from a place very similar (if not identical) to yours: [What is the best practice for securely storing passwords in Java](https://stackoverflow.com/questions/7017688/what-is-the-best-practice-for-securely-storing-passwords-in-java) – Federico klez Culloca Mar 09 '22 at 11:33

0 Answers0