{"id":25976154,"url":"https://github.com/kh77/spring-boot-multi-db","last_synced_at":"2026-03-27T02:27:50.112Z","repository":{"id":38401537,"uuid":"279146946","full_name":"kh77/spring-boot-multi-db","owner":"kh77","description":"Distributed transaction using mysql and postgres","archived":false,"fork":false,"pushed_at":"2022-06-04T19:04:10.000Z","size":55,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-06T22:09:10.140Z","etag":null,"topics":["java","mysql","postgres","spring-boot"],"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/kh77.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":"2020-07-12T20:58:12.000Z","updated_at":"2022-06-04T19:04:00.000Z","dependencies_parsed_at":"2022-08-18T13:21:39.586Z","dependency_job_id":null,"html_url":"https://github.com/kh77/spring-boot-multi-db","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fspring-boot-multi-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fspring-boot-multi-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fspring-boot-multi-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fspring-boot-multi-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kh77","download_url":"https://codeload.github.com/kh77/spring-boot-multi-db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241960839,"owners_count":20049342,"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":["java","mysql","postgres","spring-boot"],"created_at":"2025-03-05T03:35:23.901Z","updated_at":"2026-03-27T02:27:50.075Z","avatar_url":"https://github.com/kh77.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-boot-multiple-db\n Register multiple DB like MySql and PostgreSql and how to handle distributed transaction of multiple DB and roll-back.\n \n \n## Database script\n1) MySQL Script and (FooDbConfig.java) which has configuration\n\nCREATE schema foo;\n\nCREATE TABLE foo.foo_data \n( id INT NOT NULL AUTO_INCREMENT,  name VARCHAR(45) NULL, PRIMARY KEY (id));\n\n\n--------------------------------------------\n\n2) PostgreSQL Script and (BarDbConfig.java) which has configuration with bar prefix in application.properties\n\nCREATE DATABASE bar\n    WITH \n    OWNER = postgres\n    ENCODING = 'UTF8'\n    CONNECTION LIMIT = -1;\n    \n    \nCREATE TABLE public.bar_data\n(\n    id bigserial,\n    name character varying(500),\n    PRIMARY KEY (id)\n)\nWITH (\n    OIDS = FALSE\n);\n\nALTER TABLE public.bar_data\n    OWNER to postgres;\n    \n-----------------------------------------------------------\n\n# Manage Multiple DB transaction and roll-back\n  This 'ChainedTransactionManagerConfig' class register both transaction manager DB and it will roll-back when one transaction is failed\n  \n  Check 'FooService' class which has 'insert' method and hit below URL to save data\n\n\n\n\n----------------------------------------------------------- \n## URL to save data from Postman \n- Save data in both DB\n- Http Method : GET\n- URL : localhost:8080/save/helloworld\n- Response body : OK\n\n\n## Uncomment RuntimeException from BarService.java\n- try above url then it will roll-back both transaction \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh77%2Fspring-boot-multi-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkh77%2Fspring-boot-multi-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh77%2Fspring-boot-multi-db/lists"}