Skip to content

GeeItsZee/DbShare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DbShare

DbShare is a helper plugin which allows you to build your HikariDataSources once and reuse them across plugins.

Step One: Edit the configuration file (config.yml)

###############################################################################
# DbShare Configuration File
###############################################################################

# List of data source that plugins can access.
Databases:
  # Name of the data source
  MainDbShare:
    # Username for connecting to the database.
    Username: mc
    # Password for connecting to the database.
    Password: dbshare
    # This should have three parts: the main URL, the port number, and database name.
    URL: localhost:3306/minecraft

Step Two: Use it in your plugin

public void updateDatabase() {
  HikariDataSource dataSource = DbShare.instance().getDataSource("MainDbShare");
  
  try(Connection connection = dataSource.getConnection()) {
    // Use the connection
  };
}

Licence (GPLv3)

DbShare - Multiple HikariDataSource manager for Spigot
Copyright (C) 2017 Trace Bachi ([email protected])

DbShare is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

DbShare is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with DbShare.  If not, see <http://www.gnu.org/licenses/>.

About

Shared HikariDataSource manager for Spigot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages