介绍
方法
一、配置mysql.properties文件
二、代码
public void connect05() throws IOException, ClassNotFoundException, SQLException {
Properties properties = new Properties();
properties.load(new FileInputStream("src\\mysql.properties"));
String user=properties.getProperty("user");
String password=properties.getProperty("password");
String driver =properties.getProperty("driver");
String url=properties.getProperty("url");
Class.forName(driver);
Connection connection=DriverManager.getConnection(url,user,password);
System.out.println("方式5"+connection);
}