Java SQL Execute execute(Statement statement, String sql)

Here you can find the source of execute(Statement statement, String sql)

Description

execute

License

Apache License

Declaration

public static ResultSet execute(Statement statement, String sql)
            throws ClassNotFoundException, SQLException, Exception 

Method Source Code

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

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

public class Main {
    public static ResultSet execute(Statement statement, String sql)
            throws ClassNotFoundException, SQLException, Exception {
        if (statement == null) {
            throw new Exception();
        }//from  www  . j  a v  a  2 s  .c  o  m

        ResultSet resultSet = null;
        try {
            resultSet = statement.executeQuery(sql);
        } catch (SQLException e) {
            throw e;
        }

        return (resultSet);
    }
}

Related

  1. execute(Connection conn, String string)
  2. execute(Connection connection, String sql)
  3. execute(Connection connection, String sql, boolean closeConn)
  4. execute(final String url, final String username, final String password, final String sql, final Consumer consumer)
  5. execute(List sql)
  6. execute(String sql, Connection connection)
  7. executeCall(Connection connection, String command, String schemaName, String tableName, int paramLength)
  8. executeCallable(Connection conn, String sql)
  9. executeCreateDB(String className, String URL, String userName, String password, String dbName)