Revision as of 16:37, 22 March 2011 by Han84 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
public static java.sql.ResultSet sqlExecuteQuery(java.sql.PreparedStatement pre) {
	java.sql.ResultSet rs = null;
	try {
		rs = pre.executeQuery();
	} catch (java.sql.SQLException ex) {
		Ts.printErr(ex);
	}
	return rs;
}
 
public static java.sql.ResultSet sqlExecuteQuery(java.sql.PreparedStatement pre, int... para) {
	java.sql.ResultSet rs = null;
	try {
		for (int i = 0; i < para.length; i++) {
			pre.setInt(i + 1, para[i]);
		}
		rs = pre.executeQuery();
	} catch (java.sql.SQLException ex) {
		Ts.printErr(ex);
	}
	return rs;
}
 
public static void printErr(java.sql.SQLException ex) {
	System.out.println("SQL State: " + ex.getSQLState());
	System.out.println("Error Code: " + ex.getErrorCode());
	Ts.printErr((java.lang.Exception) ex);
}
 
public static void printErr(java.lang.Exception ex) {
	ex.printStackTrace();
	System.exit(-1);
}


Back to JavaHowTo

Alumni Liaison

BSEE 2004, current Ph.D. student researching signal and image processing.

Landis Huffman