{"id":20474205,"url":"https://github.com/marschall/sqlid","last_synced_at":"2026-07-12T23:31:45.518Z","repository":{"id":57721301,"uuid":"376260677","full_name":"marschall/sqlid","owner":"marschall","description":"computes the Oracle SQL_ID of a JDBC query string","archived":false,"fork":false,"pushed_at":"2021-12-10T11:06:56.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T02:51:14.467Z","etag":null,"topics":["jdbc","oracle"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marschall.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}},"created_at":"2021-06-12T10:23:03.000Z","updated_at":"2021-12-10T11:06:59.000Z","dependencies_parsed_at":"2022-09-04T16:20:27.387Z","dependency_job_id":null,"html_url":"https://github.com/marschall/sqlid","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/marschall/sqlid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fsqlid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fsqlid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fsqlid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fsqlid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marschall","download_url":"https://codeload.github.com/marschall/sqlid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marschall%2Fsqlid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35405750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jdbc","oracle"],"created_at":"2024-11-15T14:28:34.973Z","updated_at":"2026-07-12T23:31:45.494Z","avatar_url":"https://github.com/marschall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"SQL_ID [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/sqlid/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/sqlid)  [![Javadoc](https://javadoc.io/badge2/com.github.marschall/sqlid/javadoc.svg)](https://javadoc.io/doc/com.github.marschall/sqlid) \n======\n\nComputes the Oracle SQL_ID of a JDBC query string.\n\nThere are three different sources from which a SQL_ID can be computed:\n\n* From a JDBC query string with positional placeholders for bind variables, eg `\"SELECT * FROM dual WHERE dummy = ?\"`\n* From a native query string with named placeholders for bind variables, eg `\"SELECT * FROM dual WHERE dummy = :val\"`\n* From a `SQLException`\n\nUsage\n-----\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.marschall\u003c/groupId\u003e\n  \u003cartifactId\u003esqlid\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIf you already have a native query string with :name as placeholders you can simply use\n\n```java\nSqlId.compute(\"SELECT * FROM dual WHERE dummy = :1 \");\n```\n\nIf you have a JDBC query string with ? as placeholders you first need to call `java.sql.Connection#nativeSQL(String)` to convert it to a native query string.\n\nIf you want more convenience `SqlIdLookup` takes care of converting form JDBC query strings to native query strings and also performs caching.\n\n\n```java\nSqlIdLookup lookup = new SqlIdLookup(dataSource, 128);\nString sqlId = lookup.getSqlIdOfJdbcString(\"SELECT * FROM dual WHERE dummy = ?\");\n```\n\nSQL_ID algorithm\n----------------\n\n1. append a `0x00` byte to the native SQL query\n1. compute the MD5 hash (it's unclear whether UTF-8 or the database encoding should be used)\n1. create a 64 bit long value out last two 32 integer values of the hash using big endian order\n1. convert to Base32, 5 bits at a time starting with the most significant bit, using the alphabet `0123456789abcdfghjkmnpqrstuvwxyz`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarschall%2Fsqlid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarschall%2Fsqlid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarschall%2Fsqlid/lists"}