Easily access your database in many plugins with minimal configuration
This API allows developers to access a database across multiple plugins by simply adding the API as a dependency to their projects. Configure once, use on any project!
- Object oriented database access using Jooq
- Connection pool and cache management using HikariCP
- Very efficient
- Safe and secure
- Lightweight
- Spigot/Paper/etc API or similar
- MySQL database
- Fork or clone this repository
- Modify the pom.xml with your database details
<url>jdbc:mysql://localhost:3306/database-name</url> <!-- Put database host:port/database-name here --> <user>username</user> <!-- Put database username here --> <password>password</password> <!-- Put database password here --> <inputSchema>database-name</inputSchema> <!-- Put database name here -->
Note: Jooq uses a plugin to generate classes that allow you to access your database. Any time you make changes to your database structure(Add tables, modify colunms, etc.) You will need to regenerate these classes.
This Jooq Code Generation Manual will show you how to generate code.
- Open your maven tool window
- Expand for Plugins section
- Expand jooq-codegen section
- Double click jooq-codegen:generate
- Build the project
- Add the compiled project as a dependency to your project
- You now have access to HikariCP and Jooq classes.
- Create a DSLContext variable
DSLContext context = DSL.using(HikariCPFactory.getDataSource(), SQLDialect.MYSQL);
- Check out this class for some example usages of the context object.
- Refer to the Jooq Manual
Contact me on Discord(Playajames#5723) or create an issue.
Contributors names and contact info
- playajames(Discord: Playajames#5723)
- 1.0-SNAPSHOT
- Initial Release
This project is licensed under the GPL-3.0 License.
Inspiration, code, snippets, etc.