Re: selecting records in a derby database

2013-10-20 Thread Dyre Tjeldvoll
On 20. okt. 2013, at 04:01, Bob M rgmatth...@orcon.net.nz wrote: hi I have a derby database and a table with over 4,000 records… It is easier to think about a table as a hash table or tree, rather than an array. So there isn't really a concept of first or last other than the

Re: selecting records in a derby database

2013-10-20 Thread Bob M
Hello Dyre Many thanks for your suggestions... The primary key consists of the first two columns being Date and Hours e.g. 01-01-2009, 0 01-01-2009, 6 01-01-2009, 12 01-01-2009, 18 02-01-2009, 0 etc. Does this lead to alternative suggestions? Bob M -- View this message in

Re: selecting records in a derby database

2013-10-20 Thread Bryan Pendleton
rs = s.executeQuery(SELECT COUNT(*) FROM TABLE_NAME); int recordCount = ??; The query returned a result set. Call next() on the result set to move to the first (and only) row in the result set. Then you can call getInt() to get the integer value of the first (and only) column in that row.

Re: selecting records in a derby database

2013-10-20 Thread Bob M
Hi Bryan so.. rs. = s.executeQuery(SELECT COUNT(*) FROM Table_name); rs.next(); int recordCount = rs.getInt(); I get compilation error on last line The method getInt(int) in the type ResultSet in not applicable for the arguments () Bob M -- View this message in context:

Re: selecting records in a derby database

2013-10-20 Thread Bryan Pendleton
int recordCount = rs.getInt(); I get compilation error on last line The method getInt(int) in the type ResultSet in not applicable for the arguments () Indeed, you have to specify the columnIndex. http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getInt(int) Specify getInt( 1