The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

sachinladdha (24) [Avatar] Offline
#1
Hi,

Is it possible to select the data source at runtime? So that all my reports can collect data from SQL server which is passed as a paramter to that report.

I am passing SQL server as a paramter to the report. The parameters are passed to CDE after Connection::Open() method. And I cannot make connection to SQL servers in any method other than Open() (A restriction in MSRS 2000).

Any workaround to solve this problem.

Please not that I am using 'Stored Credentials' to store my username/password in RDS file.

Any help is appreciated.
regards,
Sachin.
tlachev (687) [Avatar] Offline
#2
Re: Selecting Data Source at runtime (MSRS 2000)
RS 2005 supports expression-based connection strings with private data sources. In RS 2000, you need a custom data extension.
sachinladdha (24) [Avatar] Offline
#3
Re: Selecting Data Source at runtime (MSRS 2000)
Hi Teo,

I am trying to connect to different data sources through custom data extension only.

My problem is SQL server is passed as a parameter to my report. I need to open the connection to the database in IDbConnection::Open(). In Open I dont have SQL server name. I get it in IParamterCollection::Add() which gets called after Open() method.

Can I make a connection to the database in any method other than Open()?
I tried this but couldnt succeed.

Can you please elaborate more on how to achieve 'selection of data source at runtime' using custom data processing extension.

Regards,
SAchin
sachinladdha (24) [Avatar] Offline
#4
Re: Selecting Data Source at runtime (MSRS 2000)
Hi Teo,

Finally I am able to connect to DB in any method of CDE.
Below is what I did, please let me know the method I am using is correct one and will not 'fail' in any situation.----


1. Store the identity of the user who called Open() method in a member variable.
<< WindowsIdentity.GetCurrent() >>

2. Impersonate to this user before creating database connection in any other method than Open().
<< WindowsIdentity.GetCurrent().Impersonate() >>

3. undo the impersonation after opening the db connection
<<(WindowsIdentity.GetCurrent().Impersonate()).Undo() >>

So, the MSRS calls open() method under the context of the person whose credentials are stored on reportserver (using 'Stored Credentials' ) and all other methods are called under different context.

regards,
Sachin