A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
JDBC and Relational Databases
a basic question
Joined: Jan 14, 2005
Aug 11, 2005 07:29:00
how do you execute this query?
select count(*) from tablename;
the return type is int right?
so how do you execute, i mean
using stmt.execute or executeUpdate or executeQuery ???
Joined: Jun 24, 2005
Aug 11, 2005 07:39:00
You can do that with stmt.executeQuery.
Joined: Sep 20, 2003
Aug 11, 2005 07:53:00
Use executeQuery() method. It will return you ResultSet.
Using getInt() method of ResultSet you can get the count.
author & internet detective
Joined: May 26, 2003
Aug 11, 2005 18:43:00
Note that you have to point to the first row before you call rs.next(). So it looks like:
ResultSet rs = stmt.executeQuery(...); rs.next(); // we know there is exactly one row int count = rs.getInt(1);
OCA 8 book
How To Ask Questions The Smart Way
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: a basic question
Protected method access problem
Executable jar file
Spring with Quartz
Execute SAS from remote machine.
JUnit; is there a way to order tests?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015