This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I agree, the proposed solution is the opposite of what you want. The problem is actually with the database itself. Some databases can be configured to perform case insensitive matching or not, and you need to check the database settings for this. I don't recall whether or not this configured on a table/field level granularity, you'd have to consult your database software.
One alternate solution is to perform the query than perform the case sensitive matching yourself using String.equals() with the returned data although this has some other minor drawbacks such as transmitting the password back to the user (security).
I dont think which ever Database it is, you will never get case insensitive results, you will get what you queried for ( that is the minimum contract of a query).
an execute() call returning true does not mean that it has returned some case insensitive results, this means that the query was executed successfully. return instead of what you are doing now, or use executeQuery() and then ResultSet's method to see if there were really any records in the result set. correct me if I am wrong.
I would suggest, use a Query to select count * From ... if it is not too expensive on the applicaiton process. [ October 25, 2005: Message edited by: RajaniKanth Bhargava ]
but this would make my query case insensitive... I don't think that is advisable when querying password fields right? I need it to be case sensitive like...
HELLO is not the same as hello...
Woops! Miss-read your post. Sorry. Scott Selikoff is right - you'll need to configure your database to be case sensitive. If that's not an option, you'll have to check that results in you applcaition after they are returned.