database - Exporting a Java project that uses PostgreSQL -


i couldn't find answer question. how can export java project makes use of postgresql database?

i want use same database on computer. need export database project? how can done?

what should connection url be, database accessible on computer?

i'm using jdbc, , i'm on windows.

thanks in advance.

edit: wouldn't need dynamically retrieve username , password on other computer, instead of using specific username , password have on computer in postgresql?

it depends on want achieve.

shared database between hosts

do want application on both computers use same database, changes made 1 seen on other? if so, need configure each copy of application connect same database instance on 1 of machines. done changing jdbc url. you'll need configure postgresql on machine that'll database server allows connections other hosts, ensure can talk each other on tcp/ip, etc.

fresh db on each host

do want each install have separate instance of database, changes made on 1 have no effect on other, , each instance starts out blank, empty database (or 1 static contents lookup tables)? if so, should define database using sql scripts, have application run sql scripts when first installed on machine. if you've defined database hand far, can use pg_dump create sql script can use basis this, advise tools liquibase schema management instead.

"fork" current state

do want each instance of application on machine have independent database, changes made on 1 have no effect on other instances on other machines, starting state of install in database on other host? if so, need dump , reload database alongside application, using pg_dump -fc , pg_restore. can automate within application / build system using tools processbuilder, or manually.

there's no generic, canned way this. it'll require define application deployment procedure, maybe produce installer, etc.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -