JDBC
时间:2021-07-01 10:21:17
帮助过:9人阅读
1,加载驱动
Class.forName("com.mysql.jdbc.Driver"
);
//2,获得连接
Connection conn =
DriverManager.getConnection(url, username, password);
//3创建Statement
Statement st =
conn.createStatement();
//4.执行语句
ResultSet rs =
st.executeQuery(sql);
//5,处理结果
while(rs.next()){
}
//6,清理环境
rs.close();
st.close();
conn.close();
View Code
JDBC
标签:create pos 驱动程序 close 需要 分享 ext tco bubuko