I have checked in Sqlplus there are two entries in the table login. It does not go into the loop while(rs.next());
How do I fix this so it works?
Thanks,
Sonia
Edwin Dalorzo
Ranch Hand
Joined: Dec 31, 2004
Posts: 961
posted
0
If you do this, what do you get?
sonia pandit
Ranch Hand
Joined: Apr 19, 2008
Posts: 137
posted
0
I cannot do that. I have to use the connection and stmt to execute a query to the database.
THanks,
SOnia
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
"System.out.println" has nothing to do with the DB - it serves as a debugging aid. The point Edwin was trying to make is that you should check what the actual query looks like that gets sent to the DB.
As a side note, it is much better to use a PreparedStatement than to construct the query on the fly using string concatenation. Amongst other benefits, it makes sure that the code isn't susceptible to SQL injection attacks.
It was a matter of case. I changed the column to uppercase and it works. I did not realize SQL was case sensitive.
I also changed it to use Prepared Statement. Now somebody has adviced me to use Hibernate and Spring. So I have to research that. Sure I will be posting questions with that.
Thanks,
Sonia
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.