Java examples for java.sql:Stored Procedure
call your own stored procedure to get Found Rows
//package com.java2s; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static int getFoundRows(Connection conn) { Statement stmt = null;/*from w w w . jav a 2s . c o m*/ ResultSet rs = null; try { stmt = getStatement(conn); rs = stmt.executeQuery("SELECT FOUND_ROWS()"); if (rs.next()) { return rs.getInt(1); } } catch (SQLException e) { e.printStackTrace(); } finally { closeStatement(stmt); closeResultSet(rs); } return 0; } public static Statement getStatement(Connection conn) { Statement stmt = null; try { stmt = conn.createStatement(); } catch (SQLException e) { e.printStackTrace(); } return stmt; } public static void closeStatement(Statement stmt) { if (null != stmt) { try { stmt.close(); stmt = null; } catch (SQLException e) { e.printStackTrace(); } } } public static void closeResultSet(ResultSet rs) { if (null != rs) { try { rs.close(); rs = null; } catch (SQLException e) { e.printStackTrace(); } } } }