Java servlet DB username and password storage location
I am a beginner of servlet
Solution
Can I store DB users and pass them in to the web XML for easy configuration?
>On the web Storing user names and passwords in XML is not a good thing, but you can put them in a separate file in the environment Then, on the web The location of the file is provided in XML You can also limit access to files to the root user running the application
Should I store them in code for security?
>It's a good idea to store user names and passwords in your code However, it has some disadvantages. If your credentials change, you need to recompile, build and deploy Another thing is that it is possible to identify your credentials by using a decompiler
In other words, end users can see the web XML?
>No, end users don't see the web xml. It is the configuration file of the web application, called the deployment descriptor This file will be used by the web application server during deployment
I hope you understand now!