标签:
DBConfig.properties的文件内容:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/wireless_db?useUnicode=true&characterEncoding=utf-8
username=root
password=123
1.创建对象
Properties prop = new Properties();
2.加载文件
prop.load(this.getClass().getClassLoader().getResourceAsStream(
"DBConfig.properties"));
3.获取文件具体内容
String driver = prop.getProperty("driver");
String url = prop.getProperty("url");
String username = prop.getProperty("username");
String password = prop.getProperty("password");
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/qq_26662349/article/details/47981793