{"id":27126960,"url":"https://github.com/oujesky/h2-compatibility","last_synced_at":"2026-04-10T20:47:48.441Z","repository":{"id":286525291,"uuid":"953236867","full_name":"oujesky/h2-compatibility","owner":"oujesky","description":"Library of functions to extend H2 database with functions missing in compatibility modes.","archived":false,"fork":false,"pushed_at":"2025-04-07T01:02:52.000Z","size":187,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T09:03:01.148Z","etag":null,"topics":["h2","h2-database","java","mariadb","mariadb-database","mysql","mysql-database"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oujesky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-22T22:02:55.000Z","updated_at":"2025-05-26T12:19:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"c081ea36-43c3-4642-a883-5ba1cdcafc25","html_url":"https://github.com/oujesky/h2-compatibility","commit_stats":null,"previous_names":["oujesky/h2-compatibility"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oujesky/h2-compatibility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oujesky%2Fh2-compatibility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oujesky%2Fh2-compatibility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oujesky%2Fh2-compatibility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oujesky%2Fh2-compatibility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oujesky","download_url":"https://codeload.github.com/oujesky/h2-compatibility/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oujesky%2Fh2-compatibility/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262566830,"owners_count":23329680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["h2","h2-database","java","mariadb","mariadb-database","mysql","mysql-database"],"created_at":"2025-04-07T16:35:25.256Z","updated_at":"2026-04-10T20:47:43.411Z","avatar_url":"https://github.com/oujesky.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# h2-compatibility\n\nLibrary of functions to extend [H2](https://www.h2database.com/) database with functions missing in compatibility modes.\n\nMainly for simplified integration testing in cases where running a real target database in container or standalone \ncould be considered an overkill.\n\nAim is to provide missing functions, aggregations and types as compatible as possible, with minimal additional \ndependencies and targeting same minimal JDK version as H2 project, which is currently Java 11. \nMinimum H2 version that is compatible is 2.2.x.\n\nFunctions are split into modules to minimize dependency footprint and are dynamically registered \nusing the Java `ServiceLoader` mechanism.\n\n### Disclaimer\n\nThough the functions have a suite of tests, there might be differences to original DB functions and \nthese are not optimized performance-wise - that means this library is intended for test usage and is not \nrecommended for any production or mission-critical deployment.\n\n## Usage\n\n### 1. Include required modules\n\n#### Gradle\n```kotlin\ntestImplementation(\"cz.miou.h2:h2-[DB]-[FUNCTIONS]:1.0.0\")\n```\n\n#### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecz.miou.h2\u003c/groupId\u003e\n    \u003cartifactId\u003eh2-[DB]-[FUNCTIONS]\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### 2. Load functions to database\n\n#### From SQL code\n\n```sql\nCREATE ALIAS IF NOT EXISTS H2_COMPATIBILITY FOR \"cz.miou.h2.loader.Loader.load\";\nCALL H2_COMPATIBILITY();\n```\n\n#### From Java code\n\n```java\nimport java.sql.Connection;\nimport cz.miou.h2.Loader;\n\n...\n\nConnection connection = ... // JDBC connection for H2 database\nLoader.load(connection);\n\n```\n\n#### Using Flyway migration\n\nAs a convenience option for projects using [Flyway](https://github.com/flyway/flyway) for handling database migrates, \nit's possible to add a dependency to `h2-loader-flyway` module, that will automatically provide a migration with \nversion 0 targeting a H2 database environment, that would load all currently present functions.  \n\n##### Gradle\n```kotlin\ntestRuntimeOnly(\"cz.miou.h2:h2-loader-flyway:1.0.0\")\n```\n\n##### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecz.miou.h2\u003c/groupId\u003e\n    \u003cartifactId\u003eh2-loader-flyway\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n#### Troubleshooting\n\nIf for some reason some of the functions aren't compatible with H2 anymore, it's possible to exclude them by specifying `cz.miou.h2.loader.exclude` system property with a coma separated list of function names.\n\n## Supported Functions\n\n### MariaDB / MySQL\n\n#### Gradle\n```kotlin\ntestImplementation(\"cz.miou.h2:h2-mariadb-all:1.0.0\")\n```\n\n#### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecz.miou.h2\u003c/groupId\u003e\n    \u003cartifactId\u003eh2-mariadb-all\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nIn case a stricter control over dependencies is needed, it's possible to include only as specific module.\n\n#### String functions\n\nModule `h2-mariadb-functions`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`BIN`](https://mariadb.com/kb/en/bin/)\n* [`ELT`](https://mariadb.com/kb/en/elt/)\n* [`EXPORT_SET`](https://mariadb.com/kb/en/export_set/)\n* [`FIELD`](https://mariadb.com/kb/en/field/)\n* [`FIND_IN_SET`](https://mariadb.com/kb/en/find_in_set/)\n* [`FORMAT`](https://mariadb.com/kb/en/format/)\n* [`FROM_BASE64`](https://mariadb.com/kb/en/from_base64/)\n* [`HEX`](https://mariadb.com/kb/en/hex/)\n* [`LOAD_FILE`](https://mariadb.com/kb/en/load_file/)\n* [`MAKE_SET`](https://mariadb.com/kb/en/make_set/)\n* [`MID`](https://mariadb.com/kb/en/mid/)\n* [`NATURAL_SORT_KEY`](https://mariadb.com/kb/en/natural_sort_key/)\n* [`ORD`](https://mariadb.com/kb/en/ord/)\n* [`QUOTE`](https://mariadb.com/kb/en/quote/)\n* [`REGEXP_INSTR`](https://mariadb.com/kb/en/regexp_instr/)\n* [`REVERSE`](https://mariadb.com/kb/en/reverse/)\n* [`STRCMP`](https://mariadb.com/kb/en/strcmp/)\n* [`SUBSTRING_INDEX`](https://mariadb.com/kb/en/substring_index/)\n* [`TO_BASE64`](https://mariadb.com/kb/en/to_base64/)\n* [`UNHEX`](https://mariadb.com/kb/en/unhex/)\n\n\u003c/details\u003e\n\n#### Numeric, binary and misc. functions\n\nModule `h2-mariadb-functions`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`BIT_COUNT`](https://mariadb.com/kb/en/bit_count/)\n* [`CONV`](https://mariadb.com/kb/en/conv/)\n* [`FORMAT_BYTES`](https://mariadb.com/kb/en/miscellaneous-functions-format_bytes/)\n* [`ISNULL`](https://mariadb.com/kb/en/isnull/)\n* [`LOG2`](https://mariadb.com/kb/en/log2/)\n* [`OCT`](https://mariadb.com/kb/en/oct/)\n* [`POW`](https://mariadb.com/kb/en/pow/)\n* [`SLEEP`](https://mariadb.com/kb/en/sleep/)\n* [`SYS_GUID`](https://mariadb.com/kb/en/sys_guid/)\n* [`UNCOMPRESSED_LENGTH`](https://mariadb.com/kb/en/uncompressed_length/)\n* [`UNCOMPRESS`](https://mariadb.com/kb/en/uncompress/)\n* [`UUID_SHORT`](https://mariadb.com/kb/en/uuid_short/)\n\n\u003c/details\u003e\n\n#### Date / Time functions\n\nModule `h2-mariadb-functions`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`ADDDATE`](https://mariadb.com/kb/en/adddate/)\n* [`ADDTIME`](https://mariadb.com/kb/en/addtime/)\n* [`ADD_MONTHS`](https://mariadb.com/kb/en/add_months/)\n* [`CONVERT_TZ`](https://mariadb.com/kb/en/convert_tz/)\n* [`DATE_ADD`](https://mariadb.com/kb/en/date_add/)\n* [`DATE_FORMAT`](https://mariadb.com/kb/en/date_format/)\n* [`DATE_SUB`](https://mariadb.com/kb/en/date_sub/)\n* [`FORMAT_PICO_TIME`](https://mariadb.com/kb/en/format_pico_time/)\n* [`FROM_DAYS`](https://mariadb.com/kb/en/from_days/)\n* [`MAKEDATE`](https://mariadb.com/kb/en/makedate/)\n* [`MAKETIME`](https://mariadb.com/kb/en/maketime/)\n* [`MICROSECOND`](https://mariadb.com/kb/en/microsecond/)\n* [`PERIOD_ADD`](https://mariadb.com/kb/en/period_add/)\n* [`PERIOD_DIFF`](https://mariadb.com/kb/en/period_add/)\n* [`SEC_TO_TIME`](https://mariadb.com/kb/en/sec_to_time/)\n* [`STR_TO_DATE`](https://mariadb.com/kb/en/str_to_date/)\n* [`SUBDATE`](https://mariadb.com/kb/en/subdate/)\n* [`SUBTIME`](https://mariadb.com/kb/en/subtime/)\n* [`TIME`](https://mariadb.com/kb/en/time-function/)\n* [`TIMEDIFF`](https://mariadb.com/kb/en/timediff/)\n* [`TIMESTAMP`](https://mariadb.com/kb/en/timestamp-function/)\n* [`TIME_FORMAT`](https://mariadb.com/kb/en/time_format/)\n* [`TIME_TO_SEC`](https://mariadb.com/kb/en/time_to_sec/)\n* [`TO_DAYS`](https://mariadb.com/kb/en/to_days/)\n* [`TO_SECONDS`](https://mariadb.com/kb/en/to_seconds/)\n* [`UTC_DATE`](https://mariadb.com/kb/en/utc_date/)\n* [`UTC_TIME`](https://mariadb.com/kb/en/utc_time/)\n* [`UTC_TIME`](https://mariadb.com/kb/en/utc_time/)\n* [`WEEKDAY`](https://mariadb.com/kb/en/weekday/)\n* [`WEEKOFYEAR`](https://mariadb.com/kb/en/weekofyear/)\n* [`YEARWEEK`](https://mariadb.com/kb/en/yearweek/)\n\n\u003c/details\u003e\n\n#### IP address functions\n\nModule `h2-mariadb-inet`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`INET_ATON`](https://mariadb.com/kb/en/inet_aton/)\n* [`INET_NTOA`](https://mariadb.com/kb/en/inet_ntoa/)\n* [`INET6_ATON`](https://mariadb.com/kb/en/inet6_aton/)\n* [`INET6_NTOA`](https://mariadb.com/kb/en/inet6_ntoa/)\n* [`IS_IPV4`](https://mariadb.com/kb/en/is_ipv4/)\n* [`IS_IPV4_COMPAT`](https://mariadb.com/kb/en/is_ipv4_compat/)\n* [`IS_IPV4_MAPPED`](https://mariadb.com/kb/en/is_ipv4_mapped/)\n* [`IS_IPV6`](https://mariadb.com/kb/en/is_ipv6/)\n\n\u003c/details\u003e\n\n#### Hashing and cryptography functions\n\nModule `h2-mariadb-crypto`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`AES_DECRYPT`](https://mariadb.com/kb/en/aes_decrypt/)\n* [`AES_ENCRYPT`](https://mariadb.com/kb/en/aes_encrypt/)\n* [`CRC32C`](https://mariadb.com/kb/en/crc32c/)\n* [`CRC32`](https://mariadb.com/kb/en/crc32/)\n* [`KDF`](https://mariadb.com/kb/en/kdf/)\n* [`MD5`](https://mariadb.com/kb/en/md5/)\n* [`SHA1`](https://mariadb.com/kb/en/sha1/)\n* [`SHA2`](https://mariadb.com/kb/en/sha2/)\n\n\u003c/details\u003e\n\n#### JSON functions\n\nModule `h2-mariadb-json`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`JSON_ARRAY_APPEND`](https://mariadb.com/kb/en/json_array_append/)\n* [`JSON_ARRAY_INSERT`](https://mariadb.com/kb/en/json_array_insert/)\n* [`JSON_ARRAY_INTERSECT`](https://mariadb.com/kb/en/json_array_intersect/)\n* [`JSON_COMPACT`](https://mariadb.com/kb/en/json_compact/)\n* [`JSON_CONTAINS`](https://mariadb.com/kb/en/json_contains/)\n* [`JSON_CONTAINS_PATH`](https://mariadb.com/kb/en/json_contains_path/)\n* [`JSON_DEPTH`](https://mariadb.com/kb/en/json_depth/)\n* [`JSON_DETAILED`](https://mariadb.com/kb/en/json_detailed/)\n* [`JSON_EQUALS`](https://mariadb.com/kb/en/json_equals/)\n* [`JSON_EXISTS`](https://mariadb.com/kb/en/json_exists/)\n* [`JSON_EXTRACT`](https://mariadb.com/kb/en/json_extract/)\n* [`JSON_INSERT`](https://mariadb.com/kb/en/json_insert/)\n* [`JSON_KEYS`](https://mariadb.com/kb/en/json_keys/)\n* [`JSON_KEY_VALUE`](https://mariadb.com/kb/en/json_key_value/)\n* [`JSON_LENGTH`](https://mariadb.com/kb/en/json_length/)\n* [`JSON_LOOSE`](https://mariadb.com/kb/en/json_loose/)\n* [`JSON_MERGE`](https://mariadb.com/kb/en/json_merge/)\n* [`JSON_MERGE_PATCH`](https://mariadb.com/kb/en/json_merge_patch/)\n* [`JSON_NORMALIZE`](https://mariadb.com/kb/en/json_normalize/)\n* [`JSON_OBJECT_FILTER_KEYS`](https://mariadb.com/kb/en/json_object_filter_keys/)\n* [`JSON_OBJECT_TO_ARRAY`](https://mariadb.com/kb/en/json_object_to_array/)\n* [`JSON_OVERLAPS`](https://mariadb.com/kb/en/json_overlaps/)\n* [`JSON_QUERY`](https://mariadb.com/kb/en/json_query/)\n* [`JSON_QUOTE`](https://mariadb.com/kb/en/json_quote/)\n* [`JSON_REMOVE`](https://mariadb.com/kb/en/json_remove/)\n* [`JSON_REPLACE`](https://mariadb.com/kb/en/json_replace/)\n* [`JSON_SEARCH`](https://mariadb.com/kb/en/json_search/)\n* [`JSON_SET`](https://mariadb.com/kb/en/json_set/)\n* [`JSON_TYPE`](https://mariadb.com/kb/en/json_type/)\n* [`JSON_UNQUOTE`](https://mariadb.com/kb/en/json_unquote/)\n* [`JSON_VALID`](https://mariadb.com/kb/en/json_valid/)\n* [`JSON_VALUE`](https://mariadb.com/kb/en/json_value/)\n\n\u003c/details\u003e\n\n#### UUID functions\n\nModule `h2-mariadb-uuid`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eList of supported functions\u003c/summary\u003e\n\n* [`UUIDV4`](https://mariadb.com/kb/en/uuidv4/)\n* [`UUIDV7`](https://mariadb.com/kb/en/uuidv7/)\n\n\u003c/details\u003e\n\n##### Notes\n\nDue to how `DATE`, `TIME` and `TIMESTAMP` types in H2 works, the functions behave as if MariaDB had\n[`ALLOW_INVALID_DATES`](https://mariadb.com/kb/en/sql-mode/#allow_invalid_dates), [`NO_ZERO_DATE`](https://mariadb.com/kb/en/sql-mode/#no_zero_date) and [`NO_ZERO_IN_DATE`](https://mariadb.com/kb/en/sql-mode/#no_zero_in_date) SQL modes disabled.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foujesky%2Fh2-compatibility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foujesky%2Fh2-compatibility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foujesky%2Fh2-compatibility/lists"}