public static void main(String[] args) {
Connection ct=null;
PreparedStatement ps=null;
ResultSet rs=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
ct=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORACLEWW","ww","密码");
System.out.println("ok");
ps=ct.prepareStatement("select* from emp");
System.out.println(ps);
System.out.println("right");
完成查询 并循环取出结果
rs=ps.executeQuery();
while (rs.next()){
System.out.println(rs.getString(1));
System.out.println("ok");
}
}
//抛异常~ 略
}
}
emp表也有,但是查询结果是:
ok
oracle.jdbc.driver.OraclePreparedStatement@19134f4
right
求教,这个是什么原因?谢谢~``