# Bind Page/RDLX Report to Custom Data Providers (Oracle, PostgreSQL, SQLite)

This topic discusses how to bind Page/RDLX report to custom data providers (Oracle, PostgreSQL, SQLite).

## Content




> type=note
> **Note**: When you bind a report to any custom data provider, you need to modify the ActiveReports configuration file. See [Configure ActiveReports using Config File](/activereportsnet/docs/devops/customization/configure-ar) for more information.

This topic explains how to connect to the following data providers:

*   **Oracle**: Oracle Database RDBMS. This is not a built-in data source and requires an external provider. This data source has a built-in support to locate credentials.
*   **PostgreSQL**: PostgreSQL RDBMS. This is not a built-in data source and requires an external provider. This data source has a built-in support to locate credentials.
*   **SQLite**: Compact embedded RDBMS. This is not a built-in data source and requires an external provider.

When working with a custom data provider, you may need to process user credentials to work with the target source. The **LocateCredentials** event is used for this purpose.

The event handler receives an argument of the **LocateCredentialsEventArgs** type, containing related data. The following **LocateCredentialsEventArgs** properties provide information, specific to this event.

*   **Password**: Gets ot sets the password of the credentials to be located.
*   **PromptText**: Gets ot sets the password of the credentials to be located.
*   **ReportPath**: Gets the text of prompt of the locate credentials request.
*   **UserName**: Gets ot sets the user name of the credentials to be located.

### Oracle Database

The Oracle database is not a built-in data source and requires an external provider. However, this data source has a built-in support to locate credentials.

The example below shows what code you should add to the configuration file.

```
<ReportingConfiguration>
    <Extensions>
        <Data>
             <Extension Name="ORACLE" Type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess" DisplayName="Oracle Provider" />
        </Data>
    </Extensions>
</ReportingConfiguration>
```


> type=note
> **Note**: To use the Oracle data, you must install the Oracle.ManagedDataAccess or Oracle.ManagedDataAccess.Core NuGet package.

Add the following code to connect to the Oracle Database as a new data source.

```
private PageReport LoadReport()
{
    string path = ""; // Your path to the report
    PageReport report = new PageReport(new FileInfo(path));
    report.Document.LocateCredentials += OnLocateCredentials;
    DataSource dataSource = report.Report.DataSources[0]; // Your data source
    if(dataSource.ConnectionProperties.DataProvider == "ORACLE")
    {
        dataSource.ConnectionProperties.ConnectString = ""; // Your connection string
    }
   
    return report;
}
private void OnLocateCredentials(object sender, LocateCredentialsEventArgs args)
{
    args.Password = ""; // Your password if you need it
    args.UserName = ""; // Your username if you need it
}
```


> type=note
> **Note**: We assume that the report has defined data fields and datasets, which can be done in various ways, e.g., in the Web or Windows Forms Designer.

See an example of a connection string below.

```
Data Source=[database];User Id=[username];Password=[password];Integrated Security=no;
```

To handle user credentials, you should subscribe to the **LocateCredentials** event as follows.

```
report.Document.LocateCredentials += OnLocateCredentials;
```

You should also add a handler to manage the data.

```
private void OnLocateCredentials(object sender, LocateCredentialsEventArgs args)
{
    args.Password = ""; // Your password if you need it
    args.UserName = ""; // Your username if you need it
}
```

### PostgreSQL Database

The PostgreSQL database is not a built-in data source and requires an external provider. However, this data source has a built-in support to locate credentials.

The example below shows what code you should add to the configuration file.

```
<ReportingConfiguration>
    <Extensions>
        <Data>
            <Extension Name="POSTGRESQL" Type="Npgsql.NpgsqlFactory, Npgsql" DisplayName="PostgreSQL Provider" />
        </Data>
    </Extensions>
</ReportingConfiguration>
```


> type=note
> **Note**: You must install the Npgsql NuGet package to use the PostgreSQL data.

Add the following code to connect PostgreSQL as a new data source.

```
private PageReport LoadReport()
{
    string path = ""; // Your path to the report
    PageReport report = new PageReport(new FileInfo(path));
    report.Document.LocateCredentials += OnLocateCredentials;
   
    DataSource dataSource = report.Report.DataSources[0]; // Your data source
    if(dataSource.ConnectionProperties.DataProvider == "POSTGRESQL")
    {
        dataSource.ConnectionProperties.ConnectString = ""; // Your connection string
    }
    return report;
}
private void OnLocateCredentials(object sender, LocateCredentialsEventArgs args)
{
    args.Password = ""; // Your password if you need it
    args.UserName = ""; // Your username if you need it
}
```


> type=note
> **Note**: We assume that the report has defined data fields and datasets, which can be done in various ways, e.g., in the Web or Windows Forms Designer.

See an example of a connection string below.

```
Uid=[username];Pwd=[password];Host=[host];Port=[port];Database=[dbName];
```

The code example illustrates that you are adding a PostgtreSQL data provider as a custom data provider. Subscribing to the **LocateCredentials** event allows you to handle user credentials.

### SQLite or MS SQLite Database

The example below shows what code you should add to the configuration file.

```
<ReportingConfiguration>
    <Extensions>
        <Data>
            <Extension Name="SQLITE" Type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" DisplayName="SQLite Provider" />
        </Data>
    </Extensions>
</ReportingConfiguration>
```


> type=note
> **Note**: System.Data.SQLite or System.Data.SQLite.Core NuGet package must be installed for using Sqlite data.

You can also use MS SQLite. Add the following to the configuration file.

```
<ReportingConfiguration>
    <Extensions>
        <Data>
            <Extension Name="MSSQLITE" Type="Microsoft.Data.Sqlite.SqliteFactory, Microsoft.Data.Sqlite” DisplayName="MS SQLite Provider" />
        </Data>
    </Extensions>
</ReportingConfiguration>
```


> type=note
> **Note**: You must install the Microsoft.Data.Sqlite or Microsoft.Data.Sqlite.Core NuGet packages for using the MS SQLite data.

Add the following code to connect to SQLite database as a new data source.

```
private PageReport LoadReport()
{
    string path = ""; // Your path to the report
    PageReport report = new PageReport(new FileInfo(path));
   
    DataSource dataSource = report.Report.DataSources[0]; // Your data source
    if(dataSource.ConnectionProperties.DataProvider == "SQLITE") // Or "MSSQLITE" if you use it
    {
        dataSource.ConnectionProperties.ConnectString = ""; // Your connection string
    }
    return report;
}
```

See an example of a connection string below.

```
Data Source=[dbName];Version=3;
```


> type=note
> **Note**: We assume that the report has defined data fields and datasets, which can be done in various ways, e.g., in the Web or Windows Forms Designer.