You can add a new db like this:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class Postgre {
public static void main(String[] args) {
try {
Connection c = null;
Statement statement = null;
try {
c = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432/", "postgres", "your_password");
} catch (Exception e) {
System.exit(0);
}
statement = c.createStatement();
statement.executeUpdate("create database mydb");
statement.close();
c.close();
} catch (SQLException ex) {
}
}
}