{"id":20738810,"url":"https://github.com/ebean-orm/ebean-datasource","last_synced_at":"2025-04-24T02:08:25.981Z","repository":{"id":6037694,"uuid":"54543049","full_name":"ebean-orm/ebean-datasource","owner":"ebean-orm","description":"Implementation of datasource-api - a SQL DataSource implementation","archived":false,"fork":false,"pushed_at":"2025-04-24T01:10:40.000Z","size":514,"stargazers_count":9,"open_issues_count":7,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-24T02:08:18.553Z","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/ebean-orm.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":"2016-03-23T08:28:21.000Z","updated_at":"2025-04-23T11:26:53.000Z","dependencies_parsed_at":"2024-06-21T00:19:10.304Z","dependency_job_id":"9f6c10b4-495f-447e-8d09-83bd6401dfa4","html_url":"https://github.com/ebean-orm/ebean-datasource","commit_stats":null,"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-datasource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-datasource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-datasource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-datasource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ebean-orm","download_url":"https://codeload.github.com/ebean-orm/ebean-datasource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546081,"owners_count":21448260,"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-17T06:20:46.205Z","updated_at":"2025-04-24T02:08:25.963Z","avatar_url":"https://github.com/ebean-orm.png","language":"Java","readme":"[![Build](https://github.com/ebean-orm/ebean-datasource/actions/workflows/build.yml/badge.svg)](https://github.com/ebean-orm/ebean-datasource/actions/workflows/build.yml)\n[![Maven Central : ebean](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean-datasource/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean-datasource)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ebean-orm/ebean-datasource/blob/master/LICENSE)\n[![JDK EA](https://github.com/ebean-orm/ebean-datasource/actions/workflows/jdk-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean-datasource/actions/workflows/jdk-ea.yml)\n\n# ebean-datasource\nA robust and fast SQL DataSource implementation\n\n### Example use:\n\n```java\nDataSourcePool pool = DataSourcePool.builder()\n  .name(\"mypool\")\n  .url(\"jdbc:h2:mem:test\")\n  .username(\"sa\")\n  .password(\"\")\n  .build();\n```\n\n```java\nDataSourcePool readOnlyPool = DataSourcePool.builder()\n  .name(\"mypool\")\n  .url(\"jdbc:h2:mem:test\")\n  .username(\"sa\")\n  .password(\"\")\n  .readOnly(true)\n  .autoCommit(true)\n  .build();\n```\n\nUse like any java.sql.DataSource obtaining pooled connections\n```java\n    try (Connection connection = pool.getConnection()) {\n      try (PreparedStatement stmt = connection.prepareStatement(\"create table junk (acol varchar(10))\")) {\n        stmt.execute();\n        connection.commit();\n      }\n    }\n\n```\n\nFor CRaC beforeCheckpoint() we can take the pool offline\nclosing the connections and stopping heart beat checking\n```java\n// take it offline\npool.offline();\n```\n\nFor CRaC afterRestore() we can bring the pool online\ncreating the min number of connections and re-starting heart beat checking\n```java\npool.online();\n```\n\nFor explicit shutdown of the pool\n```java\npool.shutdown();\n```\n\n### Robust and fast\n\nThis pool is robust in terms of handling loss of connectivity to the database and restoring connectivity.\nIt will automatically reset itself as needed.\n\nThis pool is fast and simple. It uses a strategy of testing connections in the background and when connections\nare returned to the pool that have throw SQLException. This makes the connection testing strategy low overhead\nbut also robust.\n\n\n\n### Mature\n\nThis pool has been is heavy use for more that 10 years and stable since April 2010 (the last major refactor to use  `java.util.concurrent.locks`).\n\nThis pool was previously part of Ebean ORM with prior history in sourceforge.\n\nThere are other good DataSource pools out there but this pool has proven to be fast, simple and robust and maintains it's status as the preferred pool for use with Ebean ORM.\n\n\n### Java modules use\n\n```java\nmodule my.example {\n\n  requires io.ebean.datasource;\n  ...\n\n}\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febean-orm%2Febean-datasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febean-orm%2Febean-datasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febean-orm%2Febean-datasource/lists"}