Forums Register Login

How to get total records

+Pie Number of slices to send: Send
Hi!!
I have a query as below in mysql
select count(*) as MAXCOUNT from table1;

how do i use this MAXCOUNT variable in my java program?
+Pie Number of slices to send: Send
what you mean in your java application ?
you can create a connection ,
create an statement,
execute the statement ,
get the result set ,
and first column in first row is your record count.

is it what you are looking for ?
+Pie Number of slices to send: Send
Yogesh,
You have two choices:

1) rs.next();
int count = rs.getInt(1);

2) rs.next();
int count = rs.getInt("maxCount");
+Pie Number of slices to send: Send
Thank you very much!!
I got the required answer.
My cellmate was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1101 times.
Similar Threads
accesing database???
Should I add a Thread.yield() ?
maxCount value
The fizz buzz coding challenge
maximum no. of connections
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:09:45.