{"id":18104763,"url":"https://github.com/baudoliver7/jdbc-toolset","last_synced_at":"2025-07-16T21:11:06.893Z","repository":{"id":37889272,"uuid":"476481214","full_name":"baudoliver7/jdbc-toolset","owner":"baudoliver7","description":"Toolset for Jdbc","archived":false,"fork":false,"pushed_at":"2024-03-21T13:10:58.000Z","size":32,"stargazers_count":4,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T10:11:36.579Z","etag":null,"topics":["connection","datasource","jdbc","tool"],"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/baudoliver7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2022-03-31T21:16:52.000Z","updated_at":"2022-05-16T19:09:15.000Z","dependencies_parsed_at":"2024-03-21T13:55:02.783Z","dependency_job_id":null,"html_url":"https://github.com/baudoliver7/jdbc-toolset","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baudoliver7%2Fjdbc-toolset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baudoliver7%2Fjdbc-toolset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baudoliver7%2Fjdbc-toolset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baudoliver7%2Fjdbc-toolset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baudoliver7","download_url":"https://codeload.github.com/baudoliver7/jdbc-toolset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248768034,"owners_count":21158576,"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":["connection","datasource","jdbc","tool"],"created_at":"2024-10-31T22:15:45.979Z","updated_at":"2025-04-13T19:32:41.697Z","avatar_url":"https://github.com/baudoliver7.png","language":"Java","readme":"[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/baudoliver7/jdbc-toolset)](http://www.rultor.com/p/baudoliver7/jdbc-toolset)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[![Javadoc](http://www.javadoc.io/badge/com.baudoliver7/jdbc-toolset.svg)](http://www.javadoc.io/doc/com.baudoliver7/jdbc-toolset)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/baudoliver7/jdbc-toolset/blob/master/LICENSE.txt)\n[![codecov](https://codecov.io/gh/baudoliver7/jdbc-toolset/branch/master/graph/badge.svg)](https://codecov.io/gh/baudoliver7/jdbc-toolset)\n[![Hits-of-Code](https://hitsofcode.com/github/baudoliver7/jdbc-toolset)](https://hitsofcode.com/view/github/baudoliver7/jdbc-toolset)\n[![Maven Central](https://img.shields.io/maven-central/v/com.baudoliver7/jdbc-toolset.svg)](https://maven-badges.herokuapp.com/maven-central/com.baudoliver7/jdbc-toolset)\n[![PDD status](http://www.0pdd.com/svg?name=baudoliver7/jdbc-toolset)](http://www.0pdd.com/p?name=baudoliver7/jdbc-toolset)\n\nA toolset for `Jdbc`\n\nThere is some tools:\n\n### `DataSourceWrap` and `ConnectionWrap`\n\nWe give some wrappers to easily decorate `DataSource` and `Connection`.\n\n```java\npublic final MyDataSource extends DataSourceWrap {\n    \n    public MyDataSource(final DataSource origin) {\n        super(origin);\n    }\n}\n\npublic final MyConnection extends ConnectionWrap {\n\n    public MyConnection(final Connection origin) {\n        super(origin)\n    }\n}\n``` \n\n### `LockedConnection`\n\nSometimes, you don't want some pieces of code to close your connection after use. So, to prevent\nthem to close your connection, you can decorate it with `LockedConnection` before give them\nlike this:\n\n```java\nnew LockedConnection(\n    connection\n)\n```\n\n### `LocalLockedDataSource`\n\nSometimes, you are in situations where you want to use only one connection during the current thread\nand be sure that all modifications are taken into account only when you decide to explicitly commit\nthem. Then, `LocalLockedDataSource` is your friend in such case. Just decorate your datasource like\nthis :\n\n```java\ntry (final Connection connection = datasource.getConnection()) {\n    final DataSource uds = new LocalLockedDataSource(\n        datasource, connection\n    );\n    final Connection conn1 = uds.getConnection();\n    // We do here some operations with our connection.\n    // After that, we attempt to commit and close it.\n        conn1.commit(); // no effect\n        conn1.close(); // no effect\n        ...\n    // Somewhere else in the same thread, we want a connection\n    // to do another operations.\n    final Connection conn2 = uds.getConnection(); // we get here the current connection\n        ...\n        ...\n    // We choose now to commit all changes.\n    // For that, we should use connection that is stored in the local thread `cthread`.\n        cthread.get().commit();\n};\n```\n\n## Use it in your project\n\nIf you're using Maven, you should add it to your \u003ccode\u003epom.xml\u003c/code\u003e dependencies like this:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.baudoliver7\u003c/groupId\u003e\n    \u003cartifactId\u003ejdbc-toolset\u003c/artifactId\u003e\n    \u003cversion\u003e\u003c!-- latest version --\u003e\u003c/version\u003e\n\u003c/dependency\u003e\n``` \n\n## How to contribute\n\nFork repository, make changes, send us a pull request. We will review\nyour changes and apply them to the `master` branch shortly, provided\nthey don't violate our quality standards. To avoid frustration, before\nsending us your pull request please run full Maven build:\n\n\u003e mvn clean install -Pqulice\n\nKeep in mind that JDK 8 and Maven 3.1.0 are the lowest versions you may use.\n\n## Got questions ?\n\nIf you have questions or general suggestions, don't hesitate to submit\na new [Github issue](https://github.com/baudoliver7/jdbc-toolset/issues/new).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaudoliver7%2Fjdbc-toolset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaudoliver7%2Fjdbc-toolset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaudoliver7%2Fjdbc-toolset/lists"}