JAVA 获取jdbc.properties配置信息

Properties myProperty = new Properties();
String jdbcPath = PathKit.getWebRootPath()+File.separator+"WEB-INF"+File.separator+"classes"+File.separator+"jdbc.properties"
InputStream inputStream = new FileInputStream(new File(jdbcPath));
myProperty.load(inputStream);
String driverClass = myProperty.getProperty("driverClass");
String url = myProperty.getProperty("jdbcUrl");
String user = myProperty.getProperty("user");
String password = myProperty.getProperty("password");

PathKit.getWebRootPath()为JFinal获取路径的方法。

上一篇:OSI七层与TCP/IP五层网络架构


下一篇:OSI七层与TCP/IP五层