I wrote small web application with wicket and sql2o. I have several DAO classes where I create new Sql2o instances with hardcoded username and password:
Sql2o database = new Sql2o("jdbc:oracle:thin:@127.0.0.1:1521:test", "test", "test");
If I change password I would have to change it everywhere. So my question is where and how to put these settings in wicket so it could be accessed from different classes. Maybe I should use .properties file?
You can use a .properties file, where you need to type:
jdbc.url=jdbc:oracle:thin:@//localhost:1521/your_database
jdbc.username=user
jdbc.password=password
The URL should be chaged to one of the following depending on you configurations
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.