class PoolUtil {

	public static SQLException generateSQLException(String reason, Throwable t) {
		// slow, but this is for very exceptional cases only
		try {
			// try JDK6/7 style constructor
			if (sqlExceptionClass == null){ // yes there's a chance this can race but nothing bad happens except for a performance hit...
				sqlExceptionClass = (Class<Throwable>) Class.forName(exceptionClass);
			}

				return (SQLException)sqlExceptionClass.getConstructor(String.class, Throwable.class).newInstance(reason, t);
		} catch (Exception e) {
			// fallback to JDK5
			return new SQLException(PoolUtil.stringifyException(t));
		}

	}

}