# Carbon Datasources

## Content

## Introduction

Carbon Datasource feature in Data Services Server can be used to create datasources which can be used inside data services directly through the name of the Carbon Datasource. The datasources created using Carbon Datasource feature will be persisted, and can be used when ever required.

## Create Carbon DataSource

To create the carbon datasource click on the Datasources menu item under the configuration.

Figure 1: Create Carbon Datasource menu

Click on 'Add Datasource' link in Datasources page which will direct you to a page where you can enter the details for the datasource.

You can select a datasource provider from the highlighted combo box. For the 'default' Data Source Provider, given connection properties Driver, URL, User Name and Password need to be entered.

Figure 2: Creating the Carbon Datasource

If you need to add a datasource supported by an External Datasource Provider class such as com.mysql.jdbc.jdbc2.optional.MysqlXADataSource, select 'external' as the Data Source Provider. Then enter the name and value of connection properties by clicking 'Add Property'. Given below is an example datasource of External Datasource Provider with eneterd values.

Figure 3: Creating the Carbon Datasource of External Datasource Provider

After entering the details you can test the connection by click on 'Test Connection' button on bottom of the page. Then click 'Add' to save the datasource.

Once you have created the carbon datasource, you can use it inside the data service. Select the 'Carbon Datasource' as the type of the datasource in Add datasource page in the data services wizard. Select the carbon datasource name which you have created from the drop down list.

Figure 4: Creating the datasource for Carbon Datasource

## Expose as a JNDI Datasource

The adding datasource can be exposed as a JNDI Datasource as well. Expand 'Expose as a JNDI datasource' and enter the required values. If the datasource will be using Datasource Factory, click on the checkbox 'Use Datasource Factory' and define the JNDI properties. Given below is an example JNDI configuration.

Figure 5: Expose as a JNDI Datasource

When creating the data service select the datasource type as 'JNDI' and enter the values to be used to connect to the previously created JNDI enabled datasource.

Figure 6: Creating the datasource for JNDI

## Defining Datasource Configuration Parameters

By expanding the 'Datasource Configuration Parameters' you can set the jdbc-pool properties for the datasource.

Figure 7: Expanding Datasource Configuration Parameters

Datasource Configuration Parameters with default values is showing below.

Figure 8: Datasource Configuration Parameters