Connecting and sending SQL to a Postgres server
Postgres an object-relational database. It gives everything that MySQL does, along enhanced commands and ability to store and query object data. This allows us to use the same database for both relational and document type data.
In this recipe, we're going to implement the same quotes application as we did in the previous recipe. In the There's more... section, we'll explore Postgres' additional object storage capability.
Getting ready
We'll need to install a Postgres server.
On Mac OS, we can use Homebrew (http://brew.sh):
$ brew install postgres
For Windows systems, we download a GUI installer from https://www.postgresql.org/download/windows/.
For Linux systems, we can obtain appropriate package from https://www.postgresql.org/download/linux/.
Once installed (and started) we'll want to create a database named after our system username.
After installation, in the usual command terminal, run the following:
$ createdb `whoami`
Once we have Postgres...