Java examples for java.sql:ResultSet
get Result Set from sql query
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Main{ public static ResultSet getResultSet(Statement stmt, String sql) { ResultSet rs = null;/*from www . j a v a 2s. co m*/ try { if (stmt != null) { rs = stmt.executeQuery(sql); } } catch (SQLException e) { e.printStackTrace(); } return rs; } }