I have a problem with my JDBC code. This is the relevant code:
/** method for checking password into the Oracle database */
public String CheckUserDB(String
use the varchar data type instead of char in the oracle database.
if you use char then actual size with blank space of database is compared with query parameter
and query doesnt get exucuted that is result gets false.
So use the varchar datatype in oracle database.
result.next();
storedPassword = result.getString("passwd");
You are not checking the return value of next. If you have no rows you get into trouble...
if(result.next()){
storedPassword = result.getString("passwd");
}
The problem might not be with the code but instead could be the database. Double check that the TABLE IS NOT EMPTY. You get this error if the table is empty. Keep in mind that databases like Oracle require a commit
after all your insert, update, alter statements
.Your changes might not be visible outside the database till you run a commit over the your db, I was having this problem for quite a long time. I kept on checking the table with select
statement but the problem with my oracle db was that I had not issued a commit over my db.