Java Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 306
Number of posts: 629

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
SQLException Posted by Priapus on 3 Sept 2009 at 3:56 PM
Hi,
I am trying to view all records in a Database through an html page called via a servlet. However the page returns the first row(record) only. I keep getting the following error in Apache Tomcat console window:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Invalid Descriptor Index

below is a code snippet from my servlet
Statement myStatement = databaseConnection.createStatement();  ResultSet results = myStatement.executeQuery("SELECT * FROM Classmates");

out.println("<TABLE BORDER=2, HSPACE=7>");
out.println("<TH>Name<TH>Address<TH>Town<TH>County<TH>Telephone<TH>");
while (results.next())
{
out.println("<TR>");
out.println("<TD>" + results.getString(1) + "</TD>");
out.println("<TD>" + results.getString(2) + "</TD>");
out.println("<TD>" + results.getString(3) + "</TD>");
out.println("<TD>" + results.getString(4) + "</TD>");
out.println("<TD>" + results.getString(5) + "</TD>");
out.println("<TD>" + results.getString(6) + "</TD>");
out.println("</TR>");
}
results.close();
out.println("</TABLE>");
out.println("</BODY></HTML>");


How can i fix this error?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.