我在NetBeans中用jdbc连接oracle却总是报错,求大神指点 10
<%DriverManager.registerDriver(neworacle.jdbc.OracleDriver());Stringurl="jdbc:oracle:...
<% DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); String url="jdbc:oracle:thin:@localhost:1521:orcl"; String user="studay"; String password="zxy"; Connection con= DriverManager.getConnection(url,"studay","zxy"); Statement stmt=con.createStatement(); String sql="select a.chid,a.code,a.idnumber,a.selfname,a.gender from fha_person_main a"; ResultSet rs=stmt.executeQuery(sql); //rs.last(); //移至最后一条记录 %> <br> <br> <br> <br> <br> 你要查询的病人数据表中共有 <font size="5" color="red"> <%= rs.getRow()%> </font> 人 <table border="2" bgcolor= "CCCEEE" width="600"> <tr bgcolor="CCCCCC" align="center"> <th>记录条数</th> <th>chid</th> <th>code</th> <th>idnumber</th> <th>selfname</th> <th>gender</th> </tr> <% rs.beforeFirst(); //移至第一条记录之前 while(rs.next()){ %>
展开
2015-05-28
展开全部
Statement stmt=con.createStatement();
要添加参数 ResultSet.TYPE_SCROLL_SENSITIVE,允许往后移动,因为默认是只往前的
Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
Creates a Statement object that will generate
ResultSet objects with the given type, concurrency,
and holdability.
This method is the same as the createStatement method
above, but it allows the default result set
type, concurrency, and holdability to be overridden.
Parameters:
resultSetType - one of the following ResultSet
constants:
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - one of the following ResultSet
constants:
ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLE
resultSetHoldability - one of the following ResultSet
constants:
ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
要添加参数 ResultSet.TYPE_SCROLL_SENSITIVE,允许往后移动,因为默认是只往前的
Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
Creates a Statement object that will generate
ResultSet objects with the given type, concurrency,
and holdability.
This method is the same as the createStatement method
above, but it allows the default result set
type, concurrency, and holdability to be overridden.
Parameters:
resultSetType - one of the following ResultSet
constants:
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - one of the following ResultSet
constants:
ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLE
resultSetHoldability - one of the following ResultSet
constants:
ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
追问
不行啊,大哥,还是报错啊,只要我一添加ResultSet.TYPE_SCROLL_SENSITIVE这段代码就报错,咋办啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询