myeclipse里面导入新的项目
右键>import>General>existing...>next>select root >browse>项目>finish
导jar包
右键>properties>java build path >libraries>ojdbc14-10.2.0.3.jar
获取本机ip地址cmd>ipconfig
ipv4的地址为自己的地址
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@127.0.0.1:1521:xe";
String user = "scott";
String password="tiger";
Connection conn = DriverManager.getConnection(url,user,password);
PreparedStatement pstam = conn.prepareStatement("select * from userinfo ");
ResultSet rs = pstam.executeQuery();
while(rs.next()){
System.out.println(rs.getInt("id")+rs.getString("name")+rs.getInt("age"));
}
pstam.close();
conn.close();