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,

I have written a custom data processing extension. The report uses this extension to get the dataset. The report RDS file is configured to use 'stored credentials'. but the report processing fails on 'report manager' webapplication with following error
"Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. "

What could be the reason for this error?

Another report which doesn't use custom data processing extension (using 'Microsoft SQL server' connection type) is working fine. This report is using same RDS file.



My setup details-- "We are using SQL server 2000, MSRS 2000 SP2"
1. Report server web app on one machine.
2. Report server database is on the same machine (SQL server is installed on this machine)
3. Report needs access to a different database on a different SQL server machine.
4. RDS file settings - using 'stored credentials' with Use as Windows credentials when connecting to the data source checked. The user is domain user and has access to the remote machine. The user is owner of the database user is trying to access.
5. Both the machines are in same domain.
6. I tried to print identity of the user in data processing extension. It prints the identity of the user tried to access the report (that user is given browser access)and not of user used in stored credentials

Any help is appreciated.
regards,
Sachin
sachinladdha (24) [Avatar] Offline
#2
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
Report server is installed on Windows-XP OS
tlachev (687) [Avatar] Offline
#3
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
What credential settings to you have on the RDS? When you debug, does CDE make it to IDbConnection.Open(). You may find it useful to compare your CDE implementation with this (http://www.devx.com/dbzone/Article/31336/0).
sachinladdha (24) [Avatar] Offline
#4
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
Hi Teo,

Thanks for the hint.
The problem is solved. Actually I was making database connection in the executereader method and not in th open method where I should have. Now I am making database connection in Open() method and using it in executereader.

But this brings up other problem.
My CDE is connecting to multiple databases. Does this mean that all the connections should be created in Open() only and cached in some member variables so that they can be used in ExecuteReader.

any help is appreciated.
regards,
Sachin.
tlachev (687) [Avatar] Offline
#5
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
I don't quite follow. Do you mean the user can change the connection string to point to another database? If so, what's the issue? IDbConnection.Open will be called each time the report is rendered.
sachinladdha (24) [Avatar] Offline
#6
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
Hi,

I am collecting data from multiple databases which can reside on different SQL servers. I can make the connection only in the open() method. So my question is, Is there any other way to make connection to a sql server in method other than open? If this is not possible then I have create connections to all sql servers in Open() only.

regards,
Sachin
tlachev (687) [Avatar] Offline
#7
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
I don't think you can connect only in Open(). You can do whatever you want inside the extension.
sachinladdha (24) [Avatar] Offline
#8
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
Hi Teo,

I also had the same assumption in my mind and so opened connections anywhere in my code.

But CDE proved me wrong. It allows opening a connection only in open() method. If I try to open a connection in any other method, I get following error:
Login failed for user'(null)'. Not associated with a trusted SQL server connection.

regards,
Sachin.
sachinladdha (24) [Avatar] Offline
#9
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
Finally I am able to solve the problem.

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

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

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
regards,
Sachin
NileshGokhale (1) [Avatar] Offline
#10
Re: Data processing extension - Login failed for user '(null)'. Reason: Not ass
Hi...

I am using Forms Authentication....
My Question - Is there any way to get the current logged in user name?

I am talking about the ReportServer and not the Designer...

Thanks,
Nilesh

Message was edited by:
NileshGokhale