Super Java Host
  1. Home
  2. Java hosting
  3. Java hosting with a database

Java hosting with MySQL, MariaDB or PostgreSQL

Put your database on the same server as your application. It is fast, simple to back up and closed to the internet.

One server for application and database

For most Java applications, a database on the same VPS is the simplest and fastest setup. There is no network hop between your code and your data, there is one machine to back up, and the database port is never exposed to the internet.

What we configure

  • MySQL, MariaDB or PostgreSQL installed from the Ubuntu repositories, listening only on localhost.
  • A database and a user for your application with a random password stored in a file only root can read.
  • Buffers sized to about 15% of RAM (innodb_buffer_pool_size for MySQL and MariaDB, shared_buffers for PostgreSQL).
  • A nightly dump with a cron job, kept on the server. Managed plans also send backups offsite.

Connecting from Java

# MySQL / MariaDB
jdbc:mysql://127.0.0.1:3306/appdb

# PostgreSQL
jdbc:postgresql://127.0.0.1:5432/appdb

Use a connection pool such as HikariCP and keep its size modest. Every connection costs memory in the database server. A pool of 10 to 20 connections is enough for most applications.

Which database should you choose

  • PostgreSQL for new projects. Strong SQL support, JSON, extensions and very reliable.
  • MySQL or MariaDB when your application or CMS already expects them.

When to move the database to its own server

When the database needs more memory than the application, or when you scale the application to several servers. Until then, the same-server setup is cheaper and easier to run.

Your own Java server, billed monthly

Plans from €15.30 a month. Set up for you, or run for you.