pg-cmd - PostgreSQL interactive and batch query command-line tool »

Download pg-cmd Free Trial »

Connnect to PostgreSQL

In interactive mode:

pg-cmd> connect username:password@host:port/dbname;

example:

pg-cmd> connect pan:withdata@192.168.0.102:5432/test

In batch mode:

pg-cmd dsn="username:password@host:port/dbname"

example:

pg-cmd dsn="pan:withdata@192.168.0.102:5432/test"


If you want to hide password

In interactive mode:

pg-cmd> connect username@host:port/dbname;

example:

pg-cmd> connect pan@192.168.0.102:5432/test

In batch mode:

pg-cmd dsn="username@host:port/dbname"

example:

pg-cmd dsn="pan@192.168.0.102:5432/test"


Disconnect from PostgreSQL:

pg-cmd> disconnect;