{"id":24901728,"url":"https://github.com/antonsjava/jdbc","last_synced_at":"2025-10-26T22:12:05.191Z","repository":{"id":57732438,"uuid":"218983861","full_name":"antonsjava/jdbc","owner":"antonsjava","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-25T12:53:08.000Z","size":41,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-23T08:11:23.150Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/antonsjava.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-11-01T12:46:03.000Z","updated_at":"2025-05-25T12:53:12.000Z","dependencies_parsed_at":"2024-12-24T10:28:23.680Z","dependency_job_id":"9f7a3cd3-1301-494a-8a06-d8a9dbe8a095","html_url":"https://github.com/antonsjava/jdbc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antonsjava/jdbc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fjdbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fjdbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fjdbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fjdbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonsjava","download_url":"https://codeload.github.com/antonsjava/jdbc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fjdbc/sbom","scorecard":{"id":199752,"data":{"date":"2025-08-11","repo":{"name":"github.com/antonsjava/jdbc","commit":"b19b62ff43cb28d9bf4c43c7bff15be278a070aa"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T22:36:35.530Z","repository_id":57732438,"created_at":"2025-08-16T22:36:35.530Z","updated_at":"2025-08-16T22:36:35.530Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281180198,"owners_count":26456895,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"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":[],"created_at":"2025-02-01T21:17:33.028Z","updated_at":"2025-10-26T22:12:05.159Z","avatar_url":"https://github.com/antonsjava.png","language":"Java","readme":"\n# jdbc\n\nSimple DataSource implementation and DataSource wrapper with log capabilities. \n\n[Example of usage](https://github.com/antonsjava/sb-sampler/blob/main/src/main/java/sk/antons/sbsampler/repo/BookRepo.java)\n\n\n## DriverManagerDataSource\n\nDataSource implementation which creates connections using DriverManager class. \nIt makes no pooling. Creates new Connection instance each time when getConnection \nis called.\n\nIt is usefull for testing jdbc code which uses DataSource instance independently of\nenvironment which creates such instance.\n\nExample of h2 DataSource instance creation\n```java\n\tDataSource ds = DriverManagerDataSource.instance(\n\t\t\t\"org.h2.Driver\"\n\t\t\t, \"jdbc:h2:./target/databasefilename.h2;MODE=PostgreSQL\"\n\t\t\t, \"user\"\n\t\t\t, \"pass\"\n\t);\n```\n\n## LogDataSource\n\nWraps DataSource instance with some log capabilities. It logs \n - connection commits/rollbacks\n - statement executions\n - prepared statement executions with params\n - result set counts \n\nExample of wrapping DataSource instance\n```java\n\n\tds = LogDataSource.wrap(ds, \n\t\t\tLogConfig.instance(\n\t\t\t\t\t() -\u003e jdbclog.isDebugEnabled()\n\t\t\t\t\t, (message) -\u003e jdbclog.debug(message))\n\t\t);\n```\n\n### LogConfig\n\nThis class cumulates configuration of logging.\n\n - Consumer consumer - provides connection to logging real api \n - ConsumerStatus consumerStatus - provides connection to logging real api\n - boolean logStatement = true - enables loging of statement execution\n - boolean logResultSet = true - enables loging of result set counts (on close)\n - boolean logTransaction = true - enables loging of transaction boundaries\n\n### Log examples\n\nconnection boundary with connection identity 10\n```\njdbc [10] commit time: 0\n```\n\nstatement with connection identity 10 and statement identity 8\n```\njdbc [10][8] statement: select vs, description from mytable where vs = '1111111111' time: 0\n```\n\nprepared statement with connection identity 10 and statement identity 9\n```\njdbc [10][9] statement: update mytable set vs=?, description=? where vs = '1111111111' params:  ?1:1111111111 ?2:22222  result: 1 time: 1\n```\n\nresult set with connection identity 10 and statement identity 8\n```\njdbc [10][8] resultset row count: 2 first row time: 0 all row time: 2 close time: 0\n```\n\n### utilities\n\nDb wraps Connection, Statement ResultSet to one holder objects. You don't neet to hold \nthem in separate variables and correctly close them. Db holds last this objects and \nclosses previous if newone is created. And Db.close() closses all currently opend \nobjects in order ResultSet, Statement, PreparedStatement and Connection. \n(Only one statement and resultset in time is handled by the wrapper)\n\n```\ntry (Db db = Db.instance(ds)) {a\n    db.executeQuery(\"select count(*) from ra_county\");\n    if(db.rs().next()) System.out.println(\"county count: \" + db.rs().getInt(1));\n    \n    db.executeQuery(\"select count(*) from ra_street\");\n    if(db.rs().next()) System.out.println(\"street count: \" + db.rs().getInt(1));\n    \n    db.prepareStatement(\"update ra_street set name = ? where is = ?\");\n    db.ps().setString(1, \"new name\");\n    db.ps().setLong(2, 12321);\n    db.executeUpdate();\n\n\tdb.conn().commit();\n} catch(Exception e) {\n}\n```\n\nIf you have script file and you wants to execute this. \n\n```\nprivate static String SCHEMA =\n    \"\"\"\n    create table ra_region (id bigint primary key, code varchar(50), name varchar(5000));\n    create index ra_region ON ra_region (code) ; -- just comment\n    \n\tcreate table ra_county (id bigint primary key, code varchar(50), name varchar(5000));\n    create table ra_street (id bigint primary key, code varchar(50), name varchar(5000));\n\t\"\"\"\n\n   try (Db db = Db.instance(ds)) {\n       Script.instance(SCHEMA).execute(db.conn());\n       \n\t   Script.instance(new FileReader(\"/tmp/init-db.sql\"))\n                    .commitAfter(100)\n                    .execute(db.conn());\n   } catch(Exception ee) {\n   }\n```\n\n\n\n## Maven usage\n\n```\n   \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.antonsjava\u003c/groupId\u003e\n      \u003cartifactId\u003ejdbc\u003c/artifactId\u003e\n      \u003cversion\u003eLASTVERSION\u003c/version\u003e\n   \u003c/dependency\u003e\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonsjava%2Fjdbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonsjava%2Fjdbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonsjava%2Fjdbc/lists"}