HI,
Please add
rsStudente.next();
before accessing the field values.
Like
rsStudente= stat.executeQuery("SELECT Nome FROM Utenti");
if (rsStudente.next())
{
String nome = rsStudente.getString("Nome");
String passw = rsUser.getString("Password");
}
Shahzad Mahmood
Elena Palanca <[EMAIL PROTECTED]> on 09/26/2000 02:07:00 PM
Please respond to "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Shahzad Mahmood/CresSoft)
Subject: ODBC problem
Hy,
I'm tried to connect in a servlet to an ACCESS database doing a select
operation and I have the following error:
[parseRequest]Errore 2:java.sql.SQLException: [Microsoft][ODBC Driver
Manager] Stato del cursore non valido. (Invalid Cursor State)
In the Access Table I have only a row with the field Nome and Password
My code is the following:
String userId = req.getParameter( "UserId" );
try{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
Connection con = DriverManager.getConnection
("jdbc:odbc:Esami","","");
Statement stat= con.createStatement();
rsStudente= stat.executeQuery("SELECT Nome FROM Utenti");
String nome = rsStudente.getString("Nome");
String passw = rsUser.getString("Password");
if ((nome.equals(userId))) auth="true";
rsStudente.close();
stat.close();
}catch (Exception e) {
log( "[parseRequest]Errore 2:" + e.toString() );
}
Someone know what I'm doing wrong?
Thanks in advance
Elena
___________________________________________________________________________
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