SAP Knowledge Base Article - Public

1280509 - How to change Oracle services at runtime using the Crystal Reports .NET SDK?


  • Change Oracle services (servers) at runtime
  • Crystal Reports .NET SDK application

Reproducing the Issue

  • Crystal Reports XI R2
  • .NET Windows or web application 
  • Visual Studio .NET 2003, 2005 or 2008


The code below shows how you can change Oracle services (servers) at runtime using the CR .NET SDK. 

Note Oracle databases are case sensitive and you must ensure your Oracle client is configured correctly. Try both the short and long Oracle service name as the Server name. 

You can check your Oracle service name by following these steps.

  1. Go to Start > All Programs > Oracle > Configuration and Migration Tools > Net Manager
  2. Expand Local
  3. Expand Service Naming
  4. Select your service name and ensure it is the same as you are using in code


CrystalDecisions.CrystalReports.Engine.ReportDocument boReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument()
CrystalDecisions.Shared.ConnectionInfo boConnectionInfo = new ConnectionInfo();
boConnectionInfo.ServerName = "oracleServiceName"; // This is the Oracle service name
boConnectionInfo.Database = "";  // Database is left blank for Oralce
boConnectionInfo.UserID = "MyUserID";
boConnectionInfo.Password = "MyPassword";
foreach(CrystalDecisions.CrystalReports.Engine.Table boTable in boReportDocument.Database.Tables)
CrystalDecisions.Shared.TableLogOnInfo boTableLogOnInfo = boTable.LogOnInfo;
boTableLogOnInfo.ConnectionInfo = boConnectionInfo;
//boTable.Location = "SCHEMA." + boTable.Name.ToUpper();  // This is generally only required if the schema is changing too



Dim boReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim boConnectionInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo
Dim boTable As CrystalDecisions.CrystalReports.Engine.Table

With boConnectionInfo

.ServerName = "oracleServiceName" ' this is the Oracle service name
.DatabaseName = "" ' Database is left blank for Oralce
.UserID = "MyUserID"
.Password = "MyPassword"

End With
For Each boTable In boReportDocument.Database.Tables

Dim boTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo = boTable.LogOnInfo
boTableLogOnInfo.ConnectionInfo = boConnectionInfo
'boTable.Location = "SCHEMA." & boTable.Name.ToUpper()  ' This is generally only required if the schema is changing too

 More samples can be found here


KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To


SAP Crystal Reports XI R2