postgresql-embedded
postgresql-embedded copied to clipboard
when i restart program...
hello...
I am interested in this project.
So I tested a few things.
I've been using to embed by javafx is good.
However, if you quit the program, and run again , the stored data disappear .
How can I keep the data stored in the db when the program is restarted ?
there is not options...
PostgresStarter... PostgresConfig... and so on...
thanks...
Note that.
in main class... static { PostgresStarter<PostgresExecutable, PostgresProcess> runtime = PostgresStarter.getDefaultInstance(); config = new PostgresConfig(Version.V9_5_0, "127.0.0.1", 54322, DBNAME); exec = runtime.prepare(config); process = exec.start(); }
... ...
@Override protected void finalize() throws Throwable { super.finalize(); process.stop(); }
@sleepphoenix you can use embedded-services library to ease the configuration. Something like:
PostgresEmbeddedService postgres = new PostgresEmbeddedService("localhost", 5432, "test", "test", "testdb", "/path/to/my/database", true, 10000);
postgres.start();
// ...
postgres.stop();
Or you can specify Storage configuration manually. See the example here.
wow. very simple. that's good.
tomorrow, i'll be test. thanks.