Has anybody attempted to produce saved methods while using H2 database?

It always helps to check out the manual:

H2: User-Defined Functions and Stored Procedures

To gain access to the database inside a Java function, you need to do require a connection. For H2, you will find two methods for getting this type of connection:

Solution 1: When the first parameter from the Java function is really a java.sql.Connection, then your database offers the connection. For SQL, this can be a 'hidden' parameter, meaning you cannot and don't have to place it clearly. This really is recorded: User-Defined Functions and Stored Procedures, "Functions That Need an associationInch. Example:

CREATE ALIAS QUERY AS $$
ResultSet query(Connection conn, String sql) throws SQLException {
    return conn.createStatement().executeQuery(sql);
} $$;
CALL QUERY('SELECT * FROM DUAL');

Solution 2: For compatibility with Apache Derby and Oracle, You are able to open a brand new connection inside the Java function using DriverManager.getConnection("jdbc:default:connection"). This feature will come in H2 version 1.3.151 and more recent, also it it disabled automatically. Make it possible for it, append ;DEFAULT_CONNECTION=TRUE to the database URL. It is a problematic feature since the Oracle JDBC driver will attempt to solve this database URL if it's loaded prior to the H2 driver. So essentially you cannot make use of the feature when the Oracle driver is loaded (I think about this a bug within the Oracle driver).