输入banner图图片脚本导航/分类

JDBC

1.加载驱动
 Class.forName(driver_class);
2.创建数据库连接
DriverManager.getConnection(url,user,password);
3.创建PreparedStatement
  PreparedStatement ps=connection.prepareStatement(sql);
4.执行sql语句
  rs=ps.executeQuery();
5.处理结果集
  while (rs.next()){
rs.getObject();
}
6关闭连接(资源从内由外关闭)
  

/从内到外关闭
if (resultSet!=null){
resultSet.close();
}
if (preparedStatement!=null){
preparedStatement.close();
}
if (connection!=null){
connection.close();
}

JDBC

标签:resultset   name   ext   set   jdbc   statement   query   tco   manager