Database implementation

Hi there!

l am wondering what best practice is here on sponge. What database implementation should I use? MySQL, PostgreSQL or MongoDB? I have started working on MySQL for my plugin.

Thanks,
Yrlish

Sponge currently ships with MySQL, SQLite and H2 AFAIK. You can read more about database stuff here.

https://docs.spongepowered.org/master/en/plugin/database.html

I remember that doc page! That’s probably why I went with MySQL in the first place. Since the database is also accessed from somewhere else. Thanks!

Sponge also has built in pool management with Hikari if you don’t want to deal with that.

Just get the SqlService and you can get a DataSource for you to use from the pool. Also allows you to define aliased databases in the config, or have automatic plugin-dir relative H2 databases.

https://github.com/SpongePowered/SpongeAPI/blob/bleeding/src/main/java/org/spongepowered/api/service/sql/SqlService.java

1 Like

You should consider RethinkDB :slight_smile:. Frankly, the database you use depends on what your plugin does. Are you making an economy plugin or an incredibly complex Skyblock plugin?

I am working on a plugin that stores statistics. :slight_smile:

Depending on how flexible you want to make it you might go with a schema-less database. If this is the case, I’d recommend RethinkDB over MongoDB.

As for your question, Sponge doesn’t really have a “best practice” for databases, but it does ship with basic SQL support (as mentioned above).

I started working with MySQL, because I will be creating a webportal to view all these sweet statistics.

1 Like

Well, if you want live statistics, Rethink xD. It’s really up to you. Any of these choices will work :stuck_out_tongue:

Well. I think it’s easier for server admins to just use MySQL. :stuck_out_tongue: Also, I am not going for 100% live statistics. ^^