{"id":36622510,"url":"https://github.com/actframework/act-sql-common","last_synced_at":"2026-01-12T09:26:50.372Z","repository":{"id":19734492,"uuid":"87756760","full_name":"actframework/act-sql-common","owner":"actframework","description":"Common module for SQL data access plugins","archived":false,"fork":false,"pushed_at":"2022-01-21T23:08:26.000Z","size":221,"stargazers_count":5,"open_issues_count":14,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-28T08:55:23.887Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actframework.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-04-10T02:17:33.000Z","updated_at":"2021-02-20T21:39:41.000Z","dependencies_parsed_at":"2022-08-07T09:15:33.239Z","dependency_job_id":null,"html_url":"https://github.com/actframework/act-sql-common","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/actframework/act-sql-common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actframework%2Fact-sql-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actframework%2Fact-sql-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actframework%2Fact-sql-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actframework%2Fact-sql-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actframework","download_url":"https://codeload.github.com/actframework/act-sql-common/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actframework%2Fact-sql-common/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-12T09:26:49.499Z","updated_at":"2026-01-12T09:26:50.358Z","avatar_url":"https://github.com/actframework.png","language":"Java","readme":"# act-sql-common\n\n[![APL v2](https://img.shields.io/badge/license-Apache%202-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) \n[![Maven Central](https://img.shields.io/maven-central/v/org.actframework/act-sql-common.svg)](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22act-sql-common%22)\n[![Build Status](https://travis-ci.org/actframework/act-sql-common.svg?branch=master)](https://travis-ci.org/actframework/act-sql-common)\n[![codecov](https://codecov.io/gh/actframework/act-sql-common/branch/master/graph/badge.svg)](https://codecov.io/gh/actframework/act-sql-common)\n[![Javadocs](http://www.javadoc.io/badge/org.actframework/act-sql-common.svg?color=blue)](http://www.javadoc.io/doc/org.actframework/act-sql-common)\n\nCommon module for SQL database plugin\n\n## Versions\n\n| *Actframework version* | *act-sql-common version* |\n| ---------------------- | ------------------------ |\n| 1.1.0 | 1.0.0 |\n| 1.1.1 | 1.0.1 |\n\n## Configurations\n\n### 1. Data source configuration\n\n#### `url` or `jdbcUrl` or `databaseUrl`\n\nSpecifies the jdbc url of the datasource. \n\nDefault value: `jdbc:h2:./test` if h2 jdbc driver is provided, otherwise it will break the application from bootstrap.\n\n#### `driver` or `jdbcDriver` or `databaseDriver`\n\nOptionally. Specifies the jdbc driver class. If not specified the framework will infer the driver class from the `url`\n\n#### `username`\n\nSpecifies the jdbc connection username\n\nDefault value: `sa`\n\n#### `password`\n\nSpecifies the jdbc connection password\n\nDefault value: empty string\n\n#### `datasource` or `datasource.provider` \n\nSpecifies the `DataSourceProvider` implementation.\n\nAbout value and default value: \n\n1. if `hikari` found in the value then it will use the `act.db.sql.datasource.HikariDataSourceProvider`\n1. otherwise if `druid` found in the value then it will use the `act.db.sql.datasource.DruidDataSourceProvider`\n1. otherwise if the value starts with `shared:` then it will try to extract the `dbId` from the value, e.g. if value is `shared:ds1` then the `dbId` is `ds1`, after that it will try to load the db service with id `ds1` and use the datasource of that db service and feed into the current db service being configured. This allows multiple db service share the same datasource instance. **Note** app must make sure the db service been referenced has already configured and the db service must be an implementation of `SqlDbService`. If a datasource is configured as shared datasource then it does not need to configure other datasource properties e.g. url, username etc. However the `naming.convention` still needs to be configured to make the db service able to mapping between table/column and class/field.\n1. otherwise if specified then it will try to load the `DataSourceProvider` instance by using `Act.getInstance(\u003cvalue\u003e)`\n1. if not specified then system will probe the class loader by try loading `com.zaxxer.hikari.HikariConfig` or `com.alibaba.druid.pool.DruidDataSource` and load the hikari CP provider or druid provider respectively\n\n#### `autoCommit`\n\nSpecify should datasource auto commit transaction\n\nDefault value: `false`\n\n#### `minConnections`\n\nSpecify the minimum connections should be created by data source\n\nDefault value: `2`\n \n#### `maxConnections`\n\nSpecify the maximum connections can be created by data source\n\nDefault value: `10`\n\n#### `isolationLevel`\n\nSpecifies the default transaction isolation level, could be one of the following:\n\n1. `NONE` - no transaction\n1. `READ_UNCOMMITTED`\n1. `READ_COMMITTED`\n1. `REPEATABLE_READ`\n1. `SERIALIZABLE`\n\nDefault value: `READ_COMMITTED`\n\n####  `naming.convention`\n\nSpecify the naming convention to map Entity class name to table name and the property name to column name\n \nSupported values:\n\n1. `matching` - map directly (could be case insensitive)\n1. `underscore` - convert camelcase to underscore notation\n\nDefault value: `matching`\n\n### 2. DDL configuration\n\nThe ddl configuration tells the framework whether or not to generate and run DDL scripts\n\n#### `ddl.create`\n\nSpecify should framework to generate and run create table DDL\n \nDefault value: `false` unless `h2` is used as database\n\n**Note** about `h2`: if using h2 anbd the database file exists then `ddl.create` will always be treated as `false` unless `ddl.drop` is specified as `true`\n\n#### `ddl.drop`\n\nSpecify should framework to generate and run drop table DDL\n \nDefault value: `false`\n\n### 3. HikariCP specific configuration\n\n#### 3.1 `idleTimeout`\n\n```java\nString s = miscConf.get(\"idleTimeout\");\nif (null != s) {\n    int n = Integer.parseInt(s);\n    hc.setIdleTimeout(n);\n} else {\n    hc.setIdleTimeout(conf.maxInactiveTimeSecs * 1000);\n}\n```\n\n#### 3.2 `connectionInitSql`\n\n```java\ns = miscConf.get(\"connectionInitSql\");\nif (null != s) {\n    hc.setConnectionInitSql(s);\n}\n```\n\n#### 3.3 `maxLifetime`\n\n```java\ns = miscConf.get(\"maxLifetime\");\nif (null != s) {\n    long n = Long.parseLong(s);\n    hc.setMaxLifetime(n);\n} else {\n    hc.setMaxLifetime(conf.maxAgeMinutes * 60 * 1000L);\n}\n```\n\n#### 3.4 `poolName`\n\n```java\ns = miscConf.get(\"poolName\");\nif (null != s) {\n    hc.setPoolName(s);\n}\n```\n\n### 4. Druid specific configuration\n\n#### 4.1 `initialSize`\n\n```java\nDruidDataSource source = new DruidDataSource();\nString s = miscConf.get(\"initialSize\");\nif (null != s) {\n    source.setInitialSize(Integer.parseInt(s));\n} else {\n    source.setInitialSize(source.getMinIdle());\n}\n```\n\n#### 4.2 `timeBetweenEvictionRunsMillis`\n\n```java\ns = miscConf.get(\"timeBetweenEvictionRunsMillis\");\nif (null != s) {\n    source.setTimeBetweenEvictionRunsMillis(Long.parseLong(s));\n}\n```\n\n#### 4.3 `minEvictableIdleTimeMillis`\n\n```java\ns = miscConf.get(\"minEvictableIdleTimeMillis\");\nif (null != s) {\n    source.setMinEvictableIdleTimeMillis(Long.parseLong(s));\n}\n```\n\n#### 4.4 `testWhileIdle`\n\n```java\ns = miscConf.get(\"testWhileIdle\");\nif (null != s) {\n    source.setTestWhileIdle(Boolean.parseBoolean(s));\n}\n```\n\n#### 4.5 `testOnBorrow`\n\n```java\ns = miscConf.get(\"testOnBorrow\");\nif (null != s) {\n    source.setTestOnBorrow(Boolean.parseBoolean(s));\n}\n```\n\n#### 4.6 `testOnReturn`\n\n```java\ns = miscConf.get(\"testOnReturn\");\nif (null != s) {\n    source.setTestOnReturn(Boolean.parseBoolean(s));\n}\n```\n\n#### 4.7 `filters`\n\n```java\ns = miscConf.get(\"filters\");\nif (null != s) {\n    try {\n        source.setFilters(s);\n    } catch (SQLException e) {\n        throw E.unexpected(e);\n    }\n}\n```\n\n#### 4.8 `poolPreparedStatements`\n\n```java\ns = miscConf.get(\"poolPreparedStatements\");\nif (null != s) {\n    source.setPoolPreparedStatements(Boolean.parseBoolean(s));\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factframework%2Fact-sql-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factframework%2Fact-sql-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factframework%2Fact-sql-common/lists"}