import oracle.jdbc.driver.OracleDriver;
public static void main(String[] args){
try {//这些东西要写到try里面
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
Statement stmt = con.createStatement();
ResultSet rs=stmt.executeQuery("select * from users");
//rs.next() rs首先指向的是表头,必须先要next一下
System.out.println(rs.getString(1)+" "+rs.getString(2)) ;
}
rs.close();
stmt.close();
}
catch(Exception e) {
e.printStackTrace();
}
}
}