Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Friday, August 14, 2015

pgAdmin

Copy just the schema of a database: do Backup, with any format other than Plain (it requires pgsql to import it) and on the Option tab page select Schema Only.  It runs pg_dump behind the scene.  You will need pgAdmin newer than 1.16 which allowed schema-only option with Plain format only.
The problem is, version 1.20, for example, copies the whole database even if I check Schema-Only.

Back to Plain format.  In pgAdmin we choose a plain format and options as above or use comand line in CMD in folder where pgAdmin was installed as below:

pg_dump.exe --host myhost --port 8035 --username "myuser" --format plain --schema-only --no-owner --no-privileges --verbose --file "filename" "mydbname"

After generating it, in CMD run:

psql -d my-db-name -f "c:\aaa\my-exported-schema-file" -U postgres 

It will ask for the password.  The tool psql comes bundled with pgAdmin, at least it does in version 1.20.

Thursday, October 29, 2009

Using Derby aka JavaDB

  • The database package is included with j2ee package or download.
  • To start the server: go to bin folder and fire-off the startNetworkServer.bat or the like on other OS's.
  • To create a database: connect to the server with the following JDBC URL: jdbc:derby://localhost:1527/fiber1;create=true. Replace fiber1 with the name of the DB you want to be created upon connect.
  • There is a tool called DdlUtils freely available from Apache that allows migration from one DB vendor to another. That means migration of the schema and the data. Can be used via Ant or from a Java program.