Java程序
DBU1.java
在这里插入代码片
```import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.sql.*;
import java.util.Properties;
public class DBU1 {
private static String driver;
private static String url;
private static String username;
private static String password;
static {
Properties pro=new Properties();
try {
//创建类加载器
ClassLoader classLoader=DBU1.class.getClassLoader();
URL res=classLoader.getResource("jdbc.properties");
String path=res.getPath();
System.out.println(path);
pro.load(new FileReader(path));
//pro.load(new FileReader("src/db.properties"));
driver=pro.getProperty("driver");
url=pro.getProperty("url");
username=pro.getProperty("user");
password=pro.getProperty("pass