Search code examples
javajdbcresultsetverticarowcount

Counting rows in Vertica table per JDBC


How can I get the number of lines in a ResultSet, plugged on a Vertica 8 database, knowing every ResultSet is forward only when using Vertica? I'm trying to adapt an existing software, originally developped for Oracle, so if I could find a way to avoid rewritting everything using calls to SELECT count(*)... queries, it would really make my life easier...


Solution

  • How I know the Vertica JDCB (see: Vetica doc: JDBC Feature Support): "Cursors are forward only and are not scrollable. Result sets cannot be updated."

    So, you can't get the number of rows until you arrived the end of the ResultSet.