Author: Gentleman.Hu
Create Time: 2020-09-25 10:42:34
Modified by: Gentleman.Hu
Modified time: 2020-09-25 19:14:58
Email: justfeelingme@gmail.com
Home: https://crushing.xyz
Description:
//step1 load the driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
//step2 create the connection object
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","system","oracle");
//step3 create the statement object
Statement stmt=con.createStatement();
//step4 execute query
ResultSet rs=stmt.executeQuery("select * from emp");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
//step5 close the connection object
con.close();