code: public static byte[] queryBinary(DataSource ds, byte[] def, String query, Object... param) throws SQLException {
      Connection con = null;
      try {
        con = ds.getConnection();
        return queryBinary(con, def, query, param);
      } finally {
        close(con);
      }
    }
docs: Runs a SQL query that returns a single byte array value.
  @param ds The <code>DataSource</code> against which to run the query.
  @param def The default value to return if the query returns no results.
  @param query The SQL query to run.
  @param param The parameters to the SQL query.
  @return The value returned by the query, or <code>def</code> if the
  query returns no results.  It is assumed that the query
  returns a result set consisting of a single row and column, and
  that this value is a byte array.  Any additional rows or columns
  returned will be ignored.
  @throws SQLException If an error occurs while attempting to communicate
  with the database.