This is a generic plugin supporting version 8.8.19
of Tomcat JDBC CP.
- PlayFramework
2.4.3
- PlayFramework
2.4.x
- PlayFramework
2.5.x
- PlayFramework
2.6.x
- Dropwizard
3.2.x
- Dropwizard
4.0.x
Add the dependency to your build.sbt
:
"com.codacy" %% "codacy-tomcatcp" % "<latest-version>"
- Add the dependency to your
build.sbt
:
"com.codacy" %% "codacy-tomcatcp-play243" % "<latest-version>"
OR
"com.codacy" %% "codacy-tomcatcp-play24" % "<latest-version>"
OR
"com.codacy" %% "codacy-tomcatcp-play25" % "<latest-version>"
OR
"com.codacy" %% "codacy-tomcatcp-play26" % "<latest-version>"
- Now add the following lines to your
conf/application.conf
:
play.modules.disabled += "play.api.db.HikariCPModule"
play.modules.enabled += "com.codacy.tomcatcp.play.TomcatCPModule"
This will disable Hikari and enable the Tomcat plugin.
"com.codacy" %% "codacy-tomcatcp-dropwizard3" % "<latest-version>"
OR
"com.codacy" %% "codacy-tomcatcp-dropwizard4" % "<latest-version>"
If you have any problems with the connection validation query, defining a custom validator might help.
For example if you define a validatorClassName
as described bellow it will be used instead of the default.
We have com.codacy.tomcatcp.validators.TomcatValidator
that uses a timeout
to avoid blocking for long times while validating the connection.
driver = org.example.Driver
url = "jdbc:postgresql://localhost:5432/exampledb"
username = "example"
password = "example"
tomcatcp {
testOnBorrow = true
validationInterval = 5000
testWhileIdle = false
validatorClassName = "com.codacy.tomcatcp.validators.TomcatValidator"
initialSize = 2
minIdle = 2
maxActive = 5
maxIdle = 5
}
For detailed descriptions on each option check the Tomcat JDBC CP Configuration page.
The code here is highly inspired by the HikariCP plugin.
Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.
- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories
Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.
Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.
Codacy is free for Open Source projects.