Managed PostgreSQL for your Spring Boot app
PostgreSQL for your Java app with Spring Boot, created by your coding agent or two commands, backed up from the first minute.
Ask your agent
Create a PostgreSQL database for this Spring Boot app on Rowsafe Cloud and connect it with DATABASE_URL.Your agent picks a size, tells you the price and waits for your yes. Then it creates the server as you and, once it's ready (5 to 10 minutes), puts DATABASE_URL in .env. Through the Claude Code or Codex plugin, you create the login in the dashboard instead and paste it in: the password is made in your browser.
First time? Connect Rowsafe to your agent once.
Or from the terminal
rowsafe cloud create shop-db --wait
rowsafe env --on shop-dbrowsafe cloud create shows the price and asks first. rowsafe env makes the password on your computer, writes DATABASE_URL to .env and adds .env to .gitignore. Rowsafe never sees it.
Connect your app
import com.zaxxer.hikari.HikariDataSource;
import java.net.URI;
import java.net.URLDecoder;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static java.nio.charset.StandardCharsets.UTF_8;
@Configuration
class DatabaseConfig {
// DATABASE_URL is postgresql://user:password@host:5432/db?sslmode=require
@Bean
DataSource dataSource() {
URI url = URI.create(System.getenv("DATABASE_URL"));
String[] login = url.getRawUserInfo().split(":", 2);
HikariDataSource ds = new HikariDataSource();
// verify-full with Java's own trusted authorities: encrypted, and the server's certificate is checked.
ds.setJdbcUrl("jdbc:postgresql://" + url.getHost() + ":" + url.getPort() + url.getPath()
+ "?sslmode=verify-full&sslfactory=org.postgresql.ssl.DefaultJavaSSLFactory");
ds.setUsername(URLDecoder.decode(login[0], UTF_8));
ds.setPassword(URLDecoder.decode(login[1], UTF_8));
return ds;
}
}With spring-boot-starter-jdbc (or -data-jpa) and org.postgresql:postgresql. Spring doesn't read .env: export it before ./mvnw spring-boot:run (set -a; . ./.env; set +a), and set DATABASE_URL in your host's environment in production. Flyway and Liquibase use this data source.
Backups and restores
Rowsafe backs up every change, encrypted on the server with a key only you have, so you can restore to any second. Every week it restores a backup to prove it works. Restore a copy, bring back deleted rows or rewind the whole database, in one click. Before a risky change, save a Mark (rowsafe mark), or let your agent save one.
From $0.014 an hour, never more than $10 a month.
Questions
Why `DefaultJavaSSLFactory`?
By default the PostgreSQL JDBC driver looks for a certificate file in ~/.postgresql. This factory uses the authorities Java already trusts, which include the server's Let's Encrypt certificate.
How does my app's server connect?
At first only your computer can. Add your server's address under Who can connect on the server's page, or run rowsafe cloud allow shop-db ADDRESS.
Can I move my data from Supabase, Neon, RDS or Heroku?
Yes, with Move in: it copies your database while your app keeps running (from Heroku, writes pause during the copy). How it works
More guides
- Add PostgreSQL to your Next.js appNext.js, node-postgres
- Managed MySQL for your Laravel appLaravel, MySQL 8.4
- Managed PostgreSQL for your Django appDjango, psycopg
- Managed PostgreSQL for your Rails appRuby on Rails, pg
- PostgreSQL for your Express app, with PrismaNode.js, Express, Prisma
- PostgreSQL for your FastAPI app, with SQLAlchemyFastAPI, SQLAlchemy, psycopg
- PostgreSQL with pgvector for your AI apppgvector, any framework
- A Valkey (Redis) cache for your Next.js appNext.js, node-redis
- Meilisearch for your Laravel app, with ScoutLaravel Scout, Meilisearch
- Managed MariaDB for your WordPress siteWordPress, MariaDB 11.8
- Managed PostgreSQL for your Go appGo, pgx
- PostgreSQL for your app, with DrizzleDrizzle ORM, node-postgres
- Valkey (Redis) for your Laravel appLaravel, phpredis or Predis
- Valkey (Redis) for Sidekiq and your Rails appRails, Sidekiq
- Qdrant for your AI app in PythonPython, qdrant-client