import java.io.IOException;
import java.util.Properties;
public class Javatest94 {
/**
* 解析jdbc配置文件
*/
public static void main(String[] args) {
Properties properties = new Properties();
try {
//加载配置文件
properties.load(Javatest94.class.getClassLoader().getResourceAsStream("jdbc.properties"));
} catch (IOException e) {
e.printStackTrace();
}
String url = properties.getProperty("jdbc.url");
String username = properties.getProperty("jdbc.username");
String password = properties.getProperty("jdbc.password");
System.out.println("url = " + url);
System.out.println("username = " + username);
System.out.println("password = " + password);
}
}