{"id":13848374,"url":"https://github.com/swaldman/c3p0","last_synced_at":"2025-05-12T09:24:36.666Z","repository":{"id":3272805,"uuid":"4312278","full_name":"swaldman/c3p0","owner":"swaldman","description":"a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of PreparedStatements.","archived":false,"fork":false,"pushed_at":"2025-04-23T19:42:31.000Z","size":4472,"stargazers_count":1301,"open_issues_count":73,"forks_count":339,"subscribers_count":104,"default_branch":"0.11.x","last_synced_at":"2025-05-11T08:38:06.938Z","etag":null,"topics":["connection-management","connection-pool","connection-pooling","java","jdbc"],"latest_commit_sha":null,"homepage":"http://www.mchange.com/projects/c3p0","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swaldman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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":"2012-05-13T05:20:50.000Z","updated_at":"2025-04-23T19:39:26.000Z","dependencies_parsed_at":"2024-02-14T06:32:19.824Z","dependency_job_id":"4974b94c-0a21-4d01-acd9-436f957cae1d","html_url":"https://github.com/swaldman/c3p0","commit_stats":{"total_commits":528,"total_committers":8,"mean_commits":66.0,"dds":"0.12878787878787878","last_synced_commit":"1d23f73c348d12cdba643996d017acaf9183129b"},"previous_names":[],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaldman%2Fc3p0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaldman%2Fc3p0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaldman%2Fc3p0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaldman%2Fc3p0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swaldman","download_url":"https://codeload.github.com/swaldman/c3p0/tar.gz/refs/heads/0.11.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253540673,"owners_count":21924523,"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-management","connection-pool","connection-pooling","java","jdbc"],"created_at":"2024-08-04T19:00:47.871Z","updated_at":"2025-05-11T08:38:16.286Z","avatar_url":"https://github.com/swaldman.png","language":"Java","funding_links":[],"categories":["Java","数据库开发"],"sub_categories":[],"readme":"# c3p0\n\n```plaintext\n _____________________________________\n   .................................\n   ..(c3p0).........................\n   ............a.........fresh......\n   ....coat.......of........stucco..\n   .........over.......that.....old.\n   ...jdbc........driver............\n   .................................\n -------------------------------------\n```\n\nc3p0 is a mature, highly concurrent JDBC Connection pooling library, with\nsupport for caching and reuse of `PreparedStatement` objects.\n\nc3p0 is available as managed dependency on Maven Central,\n\u003ccode\u003e[groupId: com.mchange, artifactId: c3p0]\u003c/code\u003e For available versions, look [here](https://oss.sonatype.org/content/repositories/releases/com/mchange/c3p0/).\n\nPlease see the [documentation](http://www.mchange.com/projects/c3p0/) for more.\n\nFrom the current *development snapshot*, here is the latest [CHANGELOG](CHANGELOG).\n\nPlease address comments and questions to the [library author](mailto:swaldman@mchange.com).\n\nHowever, please keep in mind he is an abysmal correspondent and basically an asshole. \n\nDespite that, your feedback is very much appreciated. Pull requests are gratefully accepted. You may also open issues.\n\nThank you for your interest in c3p0. I do hope that you find it useful!\n\n### Building c3p0\n\nFor now (v0.11.0), c3p0 is built under a Java 11 VM, targetting JDK 7 classfiles for continued compatibility with legacy apps.\n\n_In order to remind me to switch to Java 11, the build will fail with an Exception if it detects an unexpected version._\n\nYou can comment this requirement out of `build.mill` if you like. It's the bit that looks like\n\n```scala\n  require(\n    sys.props(\"java.runtime.version\").startsWith(\"11\"),\n    s\"Bad build JVM: ${sys.props(\"java.runtime.version\")} -- We currently expect to build under Java 11. (We generate Java $JvmCompatVersion compatible source files.)\"\n  )\n```\n\nc3p0 relies on the excellent build tool [`mill`](https://mill-build.com/).\n\nInstall `mill`. Then, within this repository direcory, run\n\n```plaintext\n$ mill jar\n```\n\nYou'll find the raw as library `out/jar.dest/out.jar`.\n\nIf you maintain a local ivy repository, You can customize `publishVersion` in [`build.mill`](build.mill), then run\n\n```plaintext\n$ mill publishLocal\n```\n\nTo build the documentation\n\n```plaintext\n$ mill doc.docroot\n```\n\nYou can then open in your browser `out/doc/docroot.dest/index.html`\n\n### Testing c3p0\n\nBy default the tests expect to find a database at `jdbc:postgresql://localhost:5432/c3p0`.\nAs you can see, I usually test against a local postgres database. You can change this in \nthe `forkArgs` function of the `test` module, in [`build.mill`](build.mill).\n\nc3p0's testing is, um, embarrassingly informal. There is a junit test suite, but it covers a\nvery small fraction of c3p0 functionality. To run that, it's just\n\n```plaintext\n$ mill test.test\n```\n\nMostly c3p0 is tested by running a few test applications, and varying config _ad hoc_ to see how things work.\n\n_If you think c3p0 could/should be tested more professionally and automatically, me too! I'd love a pull request._\n\n[`build.mill`](build.mill) contains a lot of test applications, but the most important are\n\n```plaintext\n$ mill test.c3p0Benchmark\n```\n\nThis is c3p0 most basic, common, test-of-first-resort.\nIt runs through and times a bunch of different c3p0 operations, and puts the library through pretty good exercise\n\n```plaintext\n$ mill test.c3p0Load\n```\n\nThis one puts c3p0 under load of a 100 thread performing 1000 database operations each,\nthen terminates.\n\n```plaintext\n$ mill test.c3p0PSLoad\n```\n\nThis one puts c3p0 under load of a 100 thread performing database operations indefinitely.\nIt uses `PreparedStatement` for its database operations, so is a good way of exercising the\nstatement cache.\n\n#### Test configuration\n\nYou can observe (most of) the config of your c3p0 `DataSource` when you test, because c3p0 logs it at `INFO`\nupon the first `Connection` checkout attempt. When testing, verify that you are working with the configuration\nyou expect!\n\nTests are configured by command-line arguments and by a `c3p0.properties` file.\nTo play with different configurations, edit [`test/resources-local/c3p0.properties`](test/resources-local/c3p0.properties).\nAlso check the `forkArgs()` method in [`build.mill`](build.mill)\n\nSometimes you want to put the library through its paces with pathological configuration.\nA baseline pathological configuration is defined in [`test/resources-local-rough/c3p0.properties`](test/resources-local-rough/c3p0.properties).\n\nTo give this effect, temporarily edit [`build.mill`](build.mill):\n\n```scala\n    override def runClasspath : T[Seq[PathRef]] = T{\n      super.runClasspath() ++ localResources()\n      // super.runClasspath() ++ localResourcesRough()\n    }\n```\n\n* Comment out `super.runClasspath() ++ localResources()`\n* Uncomment in `super.runClasspath() ++ localResourcesRough()`\n\nThen of course you can edit [`test/resources-local-rough/c3p0.properties`](test/resources-local-rough/c3p0.properties).\n\n#### Test logging\n\nOften you will want to focus logging on a class or feature you are testing. By default, c3p0 tests\nare configured to use `java.util.logging.`, and be configured by the file [`test/conf-logging/logging.properties`](test/conf-logging/logging.properties).\n\nOf course you can change the config (in `c3p0.properties`) to use another logging library if you'd like,\nbut you may need to modify the build to bring third-party logging libraries in, and configure those libraries\nin their own ways.\n\n#### Testing under other JVM versions\n\nThe build insists on a particular JVM version (currently Java 11), but you may want to try tests, with\nall the necessary dependencies and the same config, under other JVM versions. To support this,\nfirst, in the build's required JVM version, run\n\n```plaintext\n% mill test.printExternalCommandBase\n```\n\nThat will print a long String, beginning with \"java\" and typically ending with a very long `CLASSPATH`.\n\nNow you can change your environment (usually reset the `JAVA_HOME` environment variable) so you run a different JVM version.\n\nPaste the long output mill printed for you onto a command line, and then append the fully qualified name of one of c3p0's\ntest applications, usually one of...\n\n* `com.mchange.v2.c3p0.test.C3P0BenchmarkApp`\n* `com.mchange.v2.c3p0.test.LoadPoolBackedDataSource`\n* `com.mchange.v2.c3p0.test.PSLoadPoolBackedDataSource`\n* `com.mchange.v2.c3p0.test.StatsTest`\n* `com.mchange.v2.c3p0.test.ProxyWrappersTest`\n* `com.mchange.v2.c3p0.test.RawConnectionOpTest`\n* `com.mchange.v2.c3p0.test.InterruptedBatchTest`\n* `com.mchange.v2.c3p0.test.ConnectionDispersionTest`\n* `com.mchange.v2.c3p0.test.OneThreadRepeatedInsertOrQueryTest`\n* `com.mchange.v2.c3p0.test.TestRefSerStuff`\n* `com.mchange.v2.c3p0.test.JavaBeanRefTest`\n* `com.mchange.v2.c3p0.test.DynamicPreparedStatementTest`\n\n\n### Building c3p0-loom\n\nBecause c3p0 currently builds under Java 11, but c3p0-loom requires Java 21, c3p0 loom is a\n[separate project](https://github.com/swaldman/c3p0-loom). \n\nIt is just a parallel mill project.\nThe instructions above apply (except `c3p0-loom` does not have independent documentation to build).\n\n### License\n\nc3p0 is licensed under [LGPL v.2.1](LICENSE-LGPL) or [EPL v.1.0](LICENSE-EPL), at your option. You may also\nopt to license c3p0 under any version of LGPL higher than v.2.1.\n\n---\n\n**Note:** c3p0 has had a good experience with reporting of a security vulnerability via Sonatype's _Central Security Project_.\nIf you find a c3p0 security issue, do consider reporting it via https://hackerone.com/central-security-project\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswaldman%2Fc3p0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswaldman%2Fc3p0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswaldman%2Fc3p0/lists"}