Hello ppl. I have a little querry on my hands
I ASSUMED that the output would be 4 identical lines. However what I am getting is
select rating as r from Ratings where bankregnum like '429' and date ='2005-04-01';
Data: CCC+
Data: CCC+
Exception in thread "main" java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7139)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3908)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5699)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:353)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:410)
My question is why it returnc correct answer twice but then freaks out? I mean getString method isnt supposed to change anything in result set so what happens?
Code:
System.out.println(query);
rS = db.executeQuery(query);
if (rS.next()) {
System.out.println("Data: " + rS.getString(attribName));
System.out.println("Data: " + rS.getString(attribName));
System.out.println("Data: " + rS.getString(attribName));
System.out.println("Data: " + rS.getString(attribName));
I ASSUMED that the output would be 4 identical lines. However what I am getting is
select rating as r from Ratings where bankregnum like '429' and date ='2005-04-01';
Data: CCC+
Data: CCC+
Exception in thread "main" java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7139)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3908)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5699)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:353)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:410)
My question is why it returnc correct answer twice but then freaks out? I mean getString method isnt supposed to change anything in result set so what happens?