{"id":21447862,"url":"https://github.com/hsbc/jdbc-inquirer","last_synced_at":"2025-07-14T20:30:54.206Z","repository":{"id":177220419,"uuid":"657660994","full_name":"hsbc/jdbc-inquirer","owner":"hsbc","description":"Tests jdbc connectivity to a source. Useful in an environment that has multiple firewalls/networks.","archived":false,"fork":false,"pushed_at":"2024-10-29T02:50:20.000Z","size":114,"stargazers_count":2,"open_issues_count":21,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T03:28:35.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hsbc.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}},"created_at":"2023-06-23T14:47:23.000Z","updated_at":"2024-09-11T08:21:43.000Z","dependencies_parsed_at":"2024-03-09T13:24:56.092Z","dependency_job_id":"95beca16-78c0-4749-8875-78679a58406b","html_url":"https://github.com/hsbc/jdbc-inquirer","commit_stats":null,"previous_names":["hsbc/jdbc-inquirer"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fjdbc-inquirer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fjdbc-inquirer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fjdbc-inquirer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsbc%2Fjdbc-inquirer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsbc","download_url":"https://codeload.github.com/hsbc/jdbc-inquirer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225994783,"owners_count":17556830,"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":[],"created_at":"2024-11-23T03:12:27.090Z","updated_at":"2024-11-23T03:12:27.740Z","avatar_url":"https://github.com/hsbc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jdbc-inquirer\n\nThe **jdbc-inquirer** checks connectivity via JDBC. When setting up environments, one would like to know if the connectivity to a database works.\n\nEspecially in complex network environments a simple `curl` or `wget` or `telnet` does not cut it or if one is working with a [distroless image](https://github.com/GoogleContainerTools/distroless).\n\nThe app got written overnight as the team we working were struggling to prove that an app from a Kubernetes cluster could do a database (which was sitting in a different network zone).\n\nFurthermore, as we were testing, we found different jdbc providers behaved very slightly differently, which meant our code had to deal with idiosyncrasies.  \n\nThe **jdbc-inquirer **could also be used to perform health checks.\n\n\n## TL;DR\n\n```shell\n#Grab jdbc-inquirer jar\ncurl -O --url 'https://repo1.maven.org/maven2/com/hsbc/engineering/jdbc-inquirer/1.0.15/jdbc-inquirer-1.0.15.jar'\n\n\n#Grab a driver jar. An example - hive jdbc\ncurl -O --url 'https://repo1.maven.org/maven2/org/apache/hive/hive-jdbc/3.1.3/hive-jdbc-3.1.3-standalone.jar'\n\n#Test connection\njava -cp \"./*\" -DJDBC_CLASS_NAME=\"org.apache.hive.jdbc.HiveDriver\" -DJDBC_USER=\"I_AM_A_USER\" -DJDBC_PASSWORD=\"I_AM_A_TOKEN\" -DJDBC_URL=\"jdbc:hive2://server:9999/schema\" com.hsbc.engineering.JDBCInquirer\n\n```\n\n## Obtaining the jar\n\n* Obtain the jar from [maven repo](https://repo1.maven.org/maven2/com/hsbc/engineering/jdbc-inquirer/1.0.1/jdbc-inquirer-1.0.1.jar)\n\nOR\n* set the following in your `pom.xml`\n\n```xml\n...\n      \u003cplugin\u003e\n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003emaven-dependency-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e3.5.0\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cid\u003ecopy\u003c/id\u003e\n            \u003cphase\u003evalidate\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ecopy\u003c/goal\u003e\n            \u003c/goals\u003e\n\n            \u003cconfiguration\u003e\n              \u003cartifactItems\u003e\n                \u003c!-- Obtain the jdbc inquirer--\u003e\n                \u003cartifactItem\u003e\n                  \u003cgroupId\u003ecom.hsbc.engineering\u003c/groupId\u003e\n                  \u003cartifactId\u003ejdbc-inquirer\u003c/artifactId\u003e\n                  \u003cversion\u003e1.0.1\u003c/version\u003e\n                  \u003cclassifier\u003estandalone\u003c/classifier\u003e\n                  \u003ctype\u003ejar\u003c/type\u003e\n                  \u003coverWrite\u003etrue\u003c/overWrite\u003e\n                  \u003coutputDirectory\u003e${project.build.directory}/\u003c/outputDirectory\u003e\n                \u003c/artifactItem\u003e\n                \u003c!-- Obtain a jdbc driver, an example below is hive --\u003e\n                \u003cartifactItem\u003e\n                  \u003cgroupId\u003eorg.apache.hive\u003c/groupId\u003e\n                  \u003cartifactId\u003ehive-jdbc\u003c/artifactId\u003e\n                  \u003cversion\u003e3.1.3\u003c/version\u003e\n                  \u003cclassifier\u003estandalone\u003c/classifier\u003e\n                  \u003ctype\u003ejar\u003c/type\u003e\n                  \u003coverWrite\u003etrue\u003c/overWrite\u003e\n                  \u003coutputDirectory\u003e${project.build.directory}/\u003c/outputDirectory\u003e\n                \u003c/artifactItem\u003e\n              \u003c/artifactItems\u003e\n              \u003coverWriteReleases\u003etrue\u003c/overWriteReleases\u003e\n              \u003coverWriteSnapshots\u003etrue\u003c/overWriteSnapshots\u003e\n            \u003c/configuration\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n```\n\n## To use\n\n```shell\n#Using system properties\njava -cp \"target/*\" -DJDBC_CLASS_NAME=\"org.apache.hive.jdbc.HiveDriver\" -DJDBC_USER=\"I_AM_A_USER\" -DJDBC_PASSWORD=\"I_AM_A_TOKEN\" -DJDBC_URL=\"jdbc:hive2://server:9999/schema\" com.hsbc.engineering.JDBCInquirer\njava -cp \"target/*\" -DJDBC_CLASS_NAME=\"org.apache.hive.jdbc.HiveDriver\" -DJDBC_USER=\"I_AM_A_USER\" -DJDBC_PASSWORD=\"I_AM_A_TOKEN\" -DJDBC_URL=\"jdbc:hive2://server:9999/schema\" -DJDBC_SQL=\"show databases\" -DRUN_PERFORMANCE_EXTRACTION_TEST='true' com.hsbc.engineering.JDBCInquirer\n\n#Launch the program\njava -cp [directory that contains this jar and the jdbc jars] com.hsbc.engineering.JDBCInquirer\n```\n\u003cbr\u003e\n\n```shell\n\n#Using environment variables\nexport JDBC_CLASS_NAME='jdbc_class_name'\nexport JDBC_URL='jdbc_url'\nexport JDBC_USER='jdbc_user'                 #optional\nexport JDBC_PASSWORD='jdbc_password'         #optional\nexport JDBC_SQL='jdbc_sql'                   #optional\nexport RUN_PERFORMANCE_EXTRACTION_TEST=true  #optional\n\n#Launch the program\njava -cp [directory that contains this jar and the jdbc jars] com.hsbc.engineering.JDBCInquirer\n```\n\n## Building the package\n\n* Clone the repo\n* Run `./mvnw package`\n\n## TODO\n* Docker container for this\n* Add JDBC specs as test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsbc%2Fjdbc-inquirer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsbc%2Fjdbc-inquirer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsbc%2Fjdbc-inquirer/lists"}