Java SQL Query executeQuery(String query)

Here you can find the source of executeQuery(String query)

Description

execute Query

License

Open Source License

Declaration

public static ResultSet executeQuery(String query) 

Method Source Code


//package com.java2s;
/*/*  ww  w. j a va 2s  .co m*/
 * The information in this document is subject to change without notice and 
 * does not represent a commitment by Headstrong Corporation. The software 
 * and/or databases described in this document are furnished under a license 
 * agreement and may be used or copied only in accordance with the terms of 
 * the agreement. 
 * 
 * Copyright ? 2008 Headstrong Corporation
 * All rights reserved.
 * 
 * $Id: HibernateUtil.java
 * $Revision: 
 * $Author: ViswanathP
 * $DateTime: Oct 29, 2009 
 */

import java.sql.Connection;

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

public class Main {
    static Connection conn;
    static Statement stmt;

    public static ResultSet executeQuery(String query) {

        ResultSet rs = null;
        try {
            stmt = conn.createStatement();
            rs = stmt.executeQuery(query);
        } catch (SQLException e) {
            System.err.println("Got an exception! ");
            e.printStackTrace();
            System.exit(0);
        }
        return rs;
    }
}

Related

  1. executeQuery(Connection connection, String query)
  2. executeQuery(Connection dbConnection, String selectString)
  3. executeQuery(java.sql.Connection con, String select, Object pk)
  4. executeQuery(Statement state, String sql)
  5. ExecuteQuery(String command)
  6. executeQuery(String sql, Connection conn, List param)
  7. executeQuery(String sql, String[] parameters)
  8. executeQuery2(java.sql.Connection con, String select, Object... pk)
  9. executeRetrievalByIDQuery(PreparedStatement theStatement, int theID)

  10. HOME | Copyright © www.java2s.com 2016