Book Image

DART Cookbook

By : Ivo Balbaert
Book Image

DART Cookbook

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Dart Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. 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.

  2. Select the public schema, and again select Edit, New Object, and then New Table.

  3. Name the table jobs, and create dbKey, type, salary, company, posted, and open as columns; dbKey is the primary key.

  4. To import the driver to your application...