Here you can find the source of getResultSet(String sql)
public static ResultSet getResultSet(String sql)
//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; } }