/////////////////// DBConnUtil.java////////////////
import java.util.Properties;
public DBConnUtil() {
super();
}
private static Properties props = new Properties();
static{
try {
InputStream is =
DBConnUtil.class.getClassLoader().getResourceAsStream("com/mycompany/util/DBConn.properties");
if (is != null) {
props.load(is);
is.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public String getProperty(String propertyName){
return props.getProperty(propertyName); // accessing the property
}
}
///////////////////// DBConn.properties//////////////////////
DEV=jdbc:oracle:thin:@devdb:1501:dev
TEST=jdbc:oracle:thin:@testdb:1502:test
PROD=jdbc:oracle:thin:@proddb:1503:prod
No comments:
Post a Comment