SQLEconomy is a plugin that combines MySQL and SQLite and puts them into an economy plugin. The great thing about SQL is it's extremely organized. Each table is like a spreadsheet, keeping everything organized. If yo don't have and experience with SQL, SQLEconomy doesn't care! It will create a table for you, all on its own.
Developing with SQLEconomy
SQLEconomy is open source! You can contribute to, or develop with, SQLEconomy at: https://gitlab.com/andrewward2001/SQLEconomy
When first running SQLEconomy, you should see an SQLException. This is normal, as the database hasn't been set up. Make sure to create your database, but NOT the corresponding table.
Set up the database with phpMyAdmin:
I'll only be covering database set up in phpMyAdmin with MySQL.
Firstly, you'll need to create a user. It needs to have a password, as well as data permissions and the CREATE permission.
Also, make you that you don't leave the hostname as "%"; it needs to match what's in your config.yml file. This will break it. Next, create a new database. Any name will work.
Once you've done all that, open your db.yml file.
HostIP - match this with what you entered in phpMyAdmin
Port - You'll probably want to leave this alone.
Name - The name of the database you create above
Table - Pick any name. SQLEconomy will make the table for you
Username / Password - Whatever you set when you made the MySQL account before.
Caching - Caches database in a local variable. This tends to be buggy.
CacheRate - How often in milliseconds (ms) the cache will update ALL records, clear, then recreate the cache. This can be inefficient and should be stretched.
You should now be good to go. Reload your plugins and you should see something like this:
You'll also need Vault to hook into other economy-based plugins (like ChestShops, for example). The Vault hook is included, just make sure you have Vault 1.5 or newer. Use /vault-info to check if SQLEconomy is in use.
Found a bug or have a suggestion?
Need some configuration help?
- _Husky_ & tips48 - Made the SQL API
- _Husky_ - helped work out some kinks
- An SQL API is included. API by tips48 and _Husky_ http://forums.bukkit.org/threads/tutorial-using-mysql-in-your-plugins.132309/. You can choose to use it through my plugin, or add it to your project.
There are many benefits of an economy plugin that uses SQL. First of all, all of the information is in a centralized location, versus a flat file. Also, SQLEconomy helps cut down RAM usage versus, say, iConomy, because it has ONE purpose whereas iConomy can store with flat files and other forms of storage which brings up RAM usage and storage on your server. Plus, flat files need to be saved/loaded whenever they're used. This doesn't. It has minimal data uploads.