java 连接oracle 数据库问题
Connection conn = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@172.16.2.229:1521:DBSERVER";
String UserName="root";
String PassWord ="root";
conn = DriverManager.getConnection(url,UserName,PassWord);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from insurance_accounts where name='胡军");
while(rs.next()){
rs.getString(0);
}
rs.close();
conn.close();
问题: rs.next 为false..是什么原因呢,有什么解决办法?
------解决方案--------------------胡军缺单引号。
------解决方案--------------------
正解