Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

SQLException

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
[code]
Statement myStatement = databaseConnection.createStatement(); ResultSet results = myStatement.executeQuery("SELECT * FROM Classmates");

out.println("");
out.println("NameAddressTownCountyTelephone");
while (results.next())
{
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
}
results.close();
out.println("
" + results.getString(1) + "" + results.getString(2) + "" + results.getString(3) + "" + results.getString(4) + "" + results.getString(5) + "" + results.getString(6) + "
");
out.println("");
[/code]

How can i fix this error?

Sign In or Register to comment.