Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

SetAllDatasetConnections for Oracle and SQL server

Hi,

 

I have a direct query report that needs to be used by multiple clients. I've created workspaces per client and my application determines which workspace to access and fetches the report from there. However, when I launch the report, I need to make sure the report is pointing to the right data source. I do have the tnsname and database name I have to connect to but my report fails to update the datasetconnectionstring. 

 

Snippet

var connectionDetails = new ConnectionDetails()
                {
                    ConnectionString = connectionString
                };
                var powerBiClient = await _client.GetPowerBiClient();
                var dataset = await powerBiClient.Datasets.GetDatasetByIdInGroupAsync(groupId, datasetId);
                if (dataset.IsEffectiveIdentityRequired.Value && dataset.IsEffectiveIdentityRolesRequired.Value)
                {
                    var response = await powerBiClient.Datasets.SetAllDatasetConnectionsInGroupAsync(groupId, datasetId, connectionDetails);
                    LogHelper.LogInfo(string.Format("Dataset {0} in workspace {1} update with connection string {2}", datasetId, groupId, connectionString));
                    //await powerBiClient.Datasets.RefreshDatasetInGroupAsync(groupId, datasetId);
                }

The connectionstring is of the following format "data source= <tnsname>" for Oracle database and "Data Source=<serverName>; Initial Catalog=<databasename>;" for SQL server database.

reports using Oracle  give me an error on the report.

Reports using SQL Server run through fine but don't update the dataset until I manually refresh the dataset.

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee


@Anonymous wrote:

Hi,

 

I have a direct query report that needs to be used by multiple clients. I've created workspaces per client and my application determines which workspace to access and fetches the report from there. However, when I launch the report, I need to make sure the report is pointing to the right data source. I do have the tnsname and database name I have to connect to but my report fails to update the datasetconnectionstring. 

 

Snippet

var connectionDetails = new ConnectionDetails()
                {
                    ConnectionString = connectionString
                };
                var powerBiClient = await _client.GetPowerBiClient();
                var dataset = await powerBiClient.Datasets.GetDatasetByIdInGroupAsync(groupId, datasetId);
                if (dataset.IsEffectiveIdentityRequired.Value && dataset.IsEffectiveIdentityRolesRequired.Value)
                {
                    var response = await powerBiClient.Datasets.SetAllDatasetConnectionsInGroupAsync(groupId, datasetId, connectionDetails);
                    LogHelper.LogInfo(string.Format("Dataset {0} in workspace {1} update with connection string {2}", datasetId, groupId, connectionString));
                    //await powerBiClient.Datasets.RefreshDatasetInGroupAsync(groupId, datasetId);
                }

The connectionstring is of the following format "data source= <tnsname>" for Oracle database and "Data Source=<serverName>; Initial Catalog=<databasename>;" for SQL server database.

reports using Oracle  give me an error on the report.

Reports using SQL Server run through fine but don't update the dataset until I manually refresh the dataset.


@Anonymous

Per my test, a connection string as below actually works.

"data source=yourOracleServerName:1522/SERVICE_NAME;persist security info=True"
Anonymous
Not applicable

@Eric_Zhang What would your tnsnames.ora file look like locally???


@Anonymous wrote:

@Eric_Zhang What would your tnsnames.ora file look like locally???


# tnsnames.ora Network Configuration File: C:\app\userxxx\virtual\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.xxxx.xxxx.xxxx.com)(PORT = 1522))


ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.xxxx.xxxx.xxxx.com)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.xxxxx.xxxx.xxxx.com)
    )
  )

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.