oracle的封装
1,先在根目录下创建一个配置文件 src->properties

2,封装工具类 util->JDBCUtil
package util;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
public class JDBCUtil {
private static String driver;
private static String url;
private static String username;
private static String password;
static {
Properties ps = new Properties();
InputStream is = JDBCUtil.class.getResourceAsStream("/properties");
try {
ps.load(is);
driver = ps.getProperty("driver");
url = ps.getProperty("url");
username = ps.getProperty("username");
password = ps.getProperty("password");
Class.forName(driver);
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public static Connection getConnection() {
Connection conn = null;
try {
conn = DriverManager.getConnection(url, username, password);
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
public static PreparedStatement getPreparedStatement(Connection conn,
String sql) {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return ps;
}
public static int executeDML(String sql, Object... objs)