Java SQL ResultSet Read getResultSet(String sql)

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

Description

get Result Set

License

Apache License

Declaration

public static ResultSet getResultSet(String sql) 

Method Source Code


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

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Main {
    public static ResultSet getResultSet(String sql) {
        Connection conn;/*from w  ww  .j  av a  2 s . com*/
        Statement stmt;
        ResultSet rs = null;
        try {
            conn = DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/rspamd?characterEncoding=utf8&useSSL=true", "root", "root");
            stmt = conn.createStatement();
            rs = stmt.executeQuery(sql);
        } catch (SQLException e) {
            System.err.println("Something error");
        }
        return rs;
    }
}

Related

  1. getResults(ResultSet result)
  2. getResultsAsMap(ResultSet rs)
  3. getResultSet(Connection c, String query)
  4. getResultSet(Connection conn, String query)
  5. getResultSet(Connection connection, String query)
  6. getResultSetColnumNames(ResultSet rs)
  7. getResultSetColumns(ResultSet rs)
  8. getResultSetDateValue(ResultSet rs, String sColumnName)
  9. GetResultSetFromQuery(String command)