.. _geoserver.postgis.gs_db_add:

Adding a PostGIS Database to GeoServer
--------------------------------------

In previous modules the task of creating a GeoServer data store for spatial data in Shapefile format was covered. This section covers the similar task of creating a data store for the PostGIS database created in previous sections. 

#. From the `Welcome Page <http://localhost:8080/geoserver>`_ navigate to :menuselection:`Config --> Data --> DataStores --> New`.

#. Select :guilabel:`Postgis` from the drop down list, enter "postgis" in the text box and click :guilabel:`New`.

   .. figure:: gs_db_add1.jpg

      Creating a new PostGIS data store

#. On the :guilabel:`Feature Data Set Editor` page:

   * Enter "bayarea" in the **database** field
   * Enter "postgres" in the **user** field
   * Enter "postgres" in the **password** field

   .. figure:: gs_db_add2.jpg

      Configuring a PostGIS database connection

   .. note::  The editor page is used to enter all the database connection information. It also provides a number of parameters that can be used to tune database performance such as connection pool size, which specifies how many open database connections can exist concurrently.

#. :guilabel:`Submit` the form and then click :guilabel:`Apply` and then :guilabel:`Save` located in the top left corner of the page.

At this point GeoServer has successfully connected to PostGIS, however no data has been published yet. In the :ref:`next <geoserver.postgis.gs_table_add>` section each table created in previous sections will be published as a feature type.