package com.kingzheng.jztag.dao;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;
/**
*
* @author kingschan
* @date 2012-11-28
* @description 查询方案操作的数据源连接
*/
public class QuerySavingConn implements AbstractConnection{
@Override
public Connection getConnection() throws Exception {
InputStream stream=Thread.currentThread().getContextClassLoader().getResourceAsStream("QueySaving.properties");
Properties properties=new Properties();
properties.load(stream);
System.out.println("Class:"+properties.getProperty("className"));
System.out.println("userName:"+properties.getProperty("userName"));
System.out.println("userPass:"+properties.getProperty("userPass"));
System.out.println("connStr:"+properties.getProperty("connStr"));
return null;
}
public static void main(String[] args) {
try {
new QuerySavingConn().getConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Java加载src目录下Properties文件
最新推荐文章于 2019-10-30 17:03:47 发布