Example of Migrating From PostgreSQL

Postgres JDBC Driver Information

Download a required version of PostgreSQL Native Driver.

Supported Driver

Class Name

org.postgresql.Driver

JDBC URL

jdbc:postgresql:dbname

PostgreSQL provides a type 4 JDBC driver. Type 4 indicates that the driver is written in pure Java, and communicates in the database system’s own network protocol. Because of this, the driver is platform independent; once compiled, the driver can be used on any system. For additional information, see PostgreSQL Driver.

Migration Commands

schema

The following sample generates a NuoDB schema from a PostgreSQL db1 database public schema and stores that in /tmp/schema.sql:

$ nuodb-migrator schema                             \
        --source.driver=org.postgresql.Driver       \
        --source.url=jdbc:postgresql:db1            \
        --source.username=postgres                  \
        --source.password=postgres                  \
        --source.schema=public                      \
        --output.path=/tmp/schema.sql

Run schema.sql in nuosql to load schema into the NuoDB db2 database in the schema test2.

$ nuosql db2@localhost --user cloud --password user --schema test2 --file /tmp/schema.sql

dump

To create a dump from the PostgreSQL db1 database tables from the public schema in CSV format to --output.path directory execute:

$ nuodb-migrator dump                               \
        --source.driver=org.postgresql.Driver       \
        --source.url=jdbc:postgresql:db1            \
        --source.username=postgres                  \
        --source.password=postgres                  \
        --source.schema=public                      \
        --output.type=csv                           \
        --output.path=/tmp/dump

load

To restore the previously created dump to a NuoDB database in the schema specified by --target.schema run this load command:

$ nuodb-migrator load                                   \
        --target.url=jdbc:com.nuodb://localhost/db2     \
        --target.schema=test2                           \
        --target.username=cloud                         \
        --target.password=user                          \
        --input.path=/tmp/dump