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