close the result set after while loop of rs


Regards

Ramesh Kesavanarayanan

Electronic Data Systems
Steeple Reach,
25, Cathedral Road,

  91-44-811 3801 to 15 ext :2186
  91-44-233 0380 (res)
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]



-----Original Message-----
From: Irvine, Alistair(LIT) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 5:19 PM
To: [EMAIL PROTECTED]
Subject: Function Sequence Error


I have developed a servlet that works fine the first time it is executed,
but when subsequently executed I get the following error:

SQLException: [Microsoft][ODBC Driver Manager] Function Sequence Error.

I am using a Microsoft Access 97 database with an ODBC datasource and a
JDBC-ODBC bridge to connect to the database.
I am also using JSDK version 2.1.

An extract of the code is given below.

Can anyone help me to solve this problem?

Thanks.
Alistair.

try{
        con = DriverManager.getConnection(url,"","");
        Statement stmt = con.createStatement();

        String query ="SELECT Task.*, Manager.MgrName FROM Task, Manager
WHERE Task.TaskMgrNN = Manager.MgrNNumber ORDER BY TaskID;";
        ResultSet rs = stmt.executeQuery(query);

        while (rs.next()){
                                int TaskID = rs.getInt("TaskID");
                                String Name = rs.getString("TaskName");
                                String Desc = rs.getString("TaskDesc");
                                String Proj = rs.getString("TaskProj");
                                String FromDate =
rs.getString("TaskFromDate");
                                String ToDate = rs.getString("TaskToDate");
                                String Priority =
rs.getString("TaskPriority");
                                String Location =
rs.getString("TaskLocation");
                                String Knowledge =
rs.getString("TaskKnowledge");
                                int PersonHrs = rs.getInt("TaskPersonHrs");
                                int NoOfStaff = rs.getInt("TaskNoOfStaff");
                                String Status = rs.getString("TaskStatus");
                                int Completion =
rs.getInt("TaskCompletion");
                                String Mgr = rs.getString("MgrName");
        }

        stmt.close();

}
catch(SQLException ex){
        System.err.println("SQLException: " + ex.getMessage());
        res.setContentType("TEXT/HTML");
        out.println("<HTML><BODY>");
        out.println("Error retrieving Tasks!<BR>");
        out.println("</BODY></HTML>");
}
finally{
        try{
                if (con != null) con.close();
        }
        catch(SQLException ignored){}
}

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to