how can I place my mysql database url, username and password in a file and how can I access them to use in my java code instead of hard coding them. I’ve tried google but am not getting clear direction
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a properties file. You can load it by the
PropertiesAPI.E.g.
config.properties:Then you can load and read it as follows (after you’ve placed it in the classpath):