postgresql-embedded icon indicating copy to clipboard operation
postgresql-embedded copied to clipboard

when i restart program...

Open sleepphoenix opened this issue 9 years ago • 3 comments
trafficstars

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...

sleepphoenix avatar Jun 29 '16 10:06 sleepphoenix

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 avatar Jun 29 '16 10:06 sleepphoenix

@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.

smecsia avatar Jun 29 '16 13:06 smecsia

wow. very simple. that's good.

tomorrow, i'll be test. thanks.

minek-admin avatar Jun 29 '16 14:06 minek-admin