/**
*
* @return Properties
* @throws IOException
*/
public Properties getProperty(String filename) throws IOException {
Properties prop = new Properties();
InputStream in = this.getClass().getResourceAsStream(
"/com/neusoft/store/twowayreferral/conf/".concat(filename));
prop.load(in);
return prop;
}
/**
* Properties配置文件
*
* @return Connection
* @throws ClassNotFoundException
* @throws SQLException
* @throws IOException
*/
public Connection getConnection(String conf_file_name)
throws ClassNotFoundException, SQLException, IOException {
Connection con = null;
Properties p = this.getProperty(conf_file_name);
Class.forName(p.getProperty("drivers"));
con = DriverManager.getConnection(p.getProperty("url"),
p.getProperty("user"), p.getProperty("password"));
return con;
}
Properties中值的读取操作
最新推荐文章于 2023-03-03 11:54:53 发布