[[data-access]]
= Using the Data Access Namespace

In addition to the core XML namespace (`gfe`), _Spring Data Geode_ provides a `gfe-data` XML namespace
primarily intended to simplify the development of Apache Geode client applications. This namespace currently contains
support for Geode <<gemfire-repositories, Repositories>> and function <<function-execution, execution>> as well as
includes a `<datasource>` tag that offers a convenient way to connect to the Apache Geode data grid.

[[data-access:datasource]]
== An Easy Way to Connect to Geode

For many applications, a basic connection to a Geode data grid using default values is sufficient.
_Spring Data Geode's_ `<datasource>` tag provides a simple way to access data. The data source creates
a `ClientCache` and connection `Pool`. In addition, it will query the cluster servers for all existing root Regions
and create an (empty) client Region proxy for each one.

[source,xml]
----
<gfe-data:datasource>
  <locator host="remotehost" port="1234"/>
</gfe-data:datasource>
----

The `<datasource>` tag is syntactically similar to `<gfe:pool>`. It may be configured with one or more nested `locator`
or `server` tags to connect to an existing data grid. Additionally, all attributes available to configure a Pool
are supported. This configuration will automatically create client Region beans for each Region defined on
cluster members connected to the Locator, so they may be seamlessly referenced by _Spring Data_ mapping annotations,
`GemfireTemplate`, and wired into application classes.

Of course, you can explicitly configure client Regions. For example, if you want to cache data in local memory:

[source,xml]
----
<gfe-data:datasource>
  <locator host="remotehost" port="1234"/>
</gfe-data:datasource>

<gfe:client-region id="Example" shortcut="CACHING_PROXY"/>
----
