oerr 01002: Fetch out of sequence
Iam trying to connect to Oracle 7.2 server using jsp script as coded below using oci driver from windows 2000 machine in which j2se 5.0 , Blazix webserver and oracle client (9.2.0.1.0) is installed.
But Iam getting error Sql exception ORA 01002 fetch out of sequence Error.
Ican access the server from the same machine using tools like TOAD successfully
Can Any body help me please ?
********Code starts here****************
<%@ page import="java.sql.*"%>
<%@ page import="java.math.*"%>
<HTML>
<HEAD><TITLE>Example</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<B>Employees</B>
<%
Connection conn = null;
try {
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(
"jdbc:oracle:oci:@rtn",
"usr",
"password");
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
conn.setAutoCommit(false);
ResultSet rs =null;
rs = stmt.executeQuery("SELECT * FROM usr.bf");
out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
out.println("<TR><TH>ID</TH><TH>Name</TH></TR>");
while(rs.next())
{
out.println("<TR>");
out.println(" <TD>" + rs.getString("tel") + "</TD>");
out.println(" <TD>" + rs.getString("cno") + "</TD>");
out.println("</TR>");
}
out.println("</TABLE>");
}
catch(SQLException e) {
out.println("SQLException: " + e.getMessage() + "<BR>");
while((e = e.getNextException()) != null)
out.println(e.getMessage() + "<BR>");
}
catch(ClassNotFoundException e) {
out.println("ClassNotFoundException: " + e.getMessage() + "<BR>");
}
finally {
//Clean up resources, close the connection.
if(conn != null) {
try {
conn.close();
}
catch (Exception ignored) {}
}}
%>
</CENTER>
</BODY>
</HTML>
*****************code ends here************************

