-2

I want to know where to store database credentials like username and password of database in a professional Java web project. Please help me

  • 1
    It depends on your needs, either web.xml or some .properties file or may be system environment variables. –  Oct 12 '18 at 15:27

1 Answers1

-1

In a typical JEE project, it a good practice to use the JEE container capability of Data Source. Data Source is where you configure your connection to database and provide the authentication details. Authentication details are provided using JAAS. Most JEE containers (servers) provide this capability.

Also, Data Source is not just for authentication, it will also be helpful in prividing the database pooling and few other benefits.

Read more on JEE 8 Tutorial

Some helpful deeplinks:

Data Sources

Java Authentication And Authorization Service

Aragorn
  • 5,021
  • 5
  • 26
  • 37