aspose file tools
The moose likes JDBC and the fly likes With out using resultset..? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "With out using resultset..?" Watch "With out using resultset..?" New topic
Author

With out using resultset..?

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Dear all

Is is possible to know where the record exists in DataBase for a preticular condition with out using Result set object
For Ex:- iwant to check the userid in database so that i will check in database and using result set i will forward my logic .


Creativity is nothing but Breaking Rules
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

ResultSet is the interface to retrieve answers from your database.
Is there a reason why you can't use it for this purpose?


OCUP UML fundamental
ITIL foundation
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

Santhosh, you might want to get someone to help you to phrase that question a little more understandably.

I think what you're trying to do is the common case where you want to see if a user is defined in a database, but you do not actually want to retrieve any of the user data. The SQL version of that would be:


Or, if you're doing a login check:


These queries do return a result set, but it has only one row and one column, and its value is either 1 (user exists, password valid) or 0 (user does not exist, or password is invalid).

So, while you need a ResultSet, the logic isn't all that complicated and the overhead is pretty low:


This code won't execute - I've done some simplifications to illustrate the concept, but it's basically how you'd do something like that.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
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.
 
subject: With out using resultset..?
 
Similar Threads
problem in getting the number of rows updated with the UPDATE statement
Result Set method that returns all rows
Partial Result Sets
DbLookup Using Drools
Passing a recordset to a class