Java examples for java.sql:ResultSet
run Query and get ResultSet
//package com.java2s; import java.sql.*; public class Main { private static ResultSet runQuery(Connection connection, String query) { try {/*from ww w . jav a 2s .c o m*/ Statement statement = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE, ResultSet.HOLD_CURSORS_OVER_COMMIT); ResultSet resultSet = statement.executeQuery(query); return (resultSet); } catch (SQLException sqle) { System.err.println("Error executing query: " + sqle); return (null); } } }