Hi, I'm just wondering how I can read the number of rows (records) in DB... ResultSet res = smnt.executeQuery("SELECT count(*) FROM table_name"); what should I do next? I mean that next may not work: String count = res.getString("???"); I'm also interested in that what is the "official" way to give an unique ID-number for each record. Do I have to give it, or does the DB-server do the job? Regards, Jorma
Or, if you prefer,About ID numbers: you can actually write a whole article about this. There is no out of the box facility to generate ID codes in SQL, but most databases have their own facilities for the purpose. For example, in Oracle you'd use sequences; in SQL Server you'd use identity columns. If you need compatibility with multiple databases, then you either use an old-fashioned "nextnum" type table, or abstract out the database-specific bits into an interface which is implemented separately for each database (data access frameworks such as Castor usually go this route). - Peter
subject: How to get row-count out from the ResultSet?