原生JDBC案例
public class TOEST { public static void main(String[] args) throws Exception { //注册驱动,反射方式加载 Class.forName("oracle.jdbc.driver.OracleDriver"); //设置url String url = "jdbc:oracle:thin:@xx.xx.xx:1521:oatest"; //设置用户名 String username = "xxx"; //设置用户密码 String password = "xxx"; //获得链接对象 Connection conn = DriverManager.getConnection(url, username, password); //获得执行者对象 //String sql = "select * from tb_susr_xx "; String sql = "select * from xxx"; PreparedStatement pr = conn.prepareStatement(sql); //获得结果集 ResultSet rs = pr.executeQuery(); //获得结果集处理 while(rs.next()){ //String id = rs.getString("satsm_id"); String rwfkrname = rs.getString("rwfkrname"); String agc=rs.getString("rwfkrid"); String rwfkfjsavemc=rs.getString("taskname"); System.out.println("遍历结果打印结果1!"+rwfkrname+agc ); } //释放资源 rs.close(); pr.close(); conn.close(); } }