Java SQL Query queryReturnRS(String sql)

Here you can find the source of queryReturnRS(String sql)

Description

query Return RS

License

Apache License

Declaration

public static ResultSet queryReturnRS(String sql) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.*;

public class Main {
    private static Connection conn = null;
    private static PreparedStatement preStatement = null;
    private static ResultSet rs = null;

    public static ResultSet queryReturnRS(String sql) {
        if (null == conn) {
            return null;
        }//w w w  . ja v  a  2  s . c  o  m
        try {
            preStatement = conn.prepareStatement(sql);
            rs = preStatement.executeQuery();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return rs;
    }
}

Related

  1. query(Connection conn, String sql, Object[] params, Class beanClass)
  2. query(Connection connection, String sql, boolean isClose, Object... params)
  3. queryForList(Connection conn, String sql, int limit)
  4. queryObjectList(Connection con, String sql, Class objClass)
  5. queryProjectTicketIdFromTicketId(Connection db, int ticketId)
  6. runQuery(Connection con, String query)
  7. runSqlSelect(String sqlQuery, Connection databaseConnection)