Java examples for java.lang:Math Number
get Total Row Number from Statement and table name
//package com.java2s; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static long getTotalRowNumber(Statement stat, String tableName) throws SQLException { long total = 0; String sql = "select count(1) from " + tableName; stat.execute(sql);/*from w ww. jav a 2 s. c o m*/ ResultSet rs = stat.getResultSet(); if (rs != null && rs.next()) { total = rs.getLong(1); } return total; } }