Storing data in PostgreSQL
PostgreSQL is another popular open source SQL database. Dart can talk to PostgreSQL using the pub package postgresql
by Greg Lowe (https://github.com/xxgreg/postgresql). In this section, we will demonstrate how to use this driver step by step. You can see it in action in the using_postgresql
project.
Getting ready
To get the database software, download and install the PostgreSQL Server installer from http://www.postgresql.org/download/ using the following steps:
- The database server is configured to start automatically. We need to create a database and table to store data. The easiest way is to start the
pgAdmin
program, make a new connection, and then select Edit, New Object, and New Database from the menu, name it jobsdb, and click on OK. - Select the public schema, and again select Edit, New Object, and then New Table.
- Name the table
jobs
, and createdbKey
,type
,salary
,company
,posted
, andopen
as columns;dbKey
is the primary key. - To import the driver to your application...