private void runInitFunctionIfRequired(final ConnectionUrl connectionUrl, Connection connection)
        throws SQLException {
        if (connectionUrl.getInitFunction().isPresent()) {
            String className = connectionUrl.getInitFunction().get().getClassName();
            String methodName = connectionUrl.getInitFunction().get().getMethodName();

            try {
                Class<?> initFunctionClazz = Class.forName(className);
                Method method = initFunctionClazz.getMethod(methodName, Connection.class);

                method.invoke(null, connection);
            } catch (
                ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e
            ) {
                LOGGER.error("Error while executing init function: {}::{}", className, methodName, e);
                throw new SQLException("Error while executing init function: " + className + "::" + methodName, e);
            }
        }
    }
Run an init function (must be a public static method on an accessible class).

@param connectionUrl {@link ConnectionUrl} instance representing JDBC Url with r init function declarations.
@param connection    JDBC connection to apply init functions to.
@throws SQLException on script or DB error
modules/jdbc/src/main/java/org/testcontainers/jdbc/ContainerDatabaseDriver.java