Saturday, February 25, 2012

Capturing ODBC user name at runtime

Hi:
We are using SRS to report from a DB2 database running on AS400's. It is
working very well.
Pushing ahead, we want to capture information on when certain reports
(actually letters) are generated. The reports prompt for login credentials
at run time. These DB2 database credentials are passed to the database
server and the report returns the data just fine. Works great right out of
the box.
What we would like to do is capture the user name that is passed to the
database. This is not the Windows AD username that can be obtained by the
global field
User!UserID, but the DB2 specific user name that is passed by the ODBC
connection.
Can this be captured at runtime? We have reviewed the RS object model and
haven't found what we are looking for. Are we barking up the wrong tree?
Thanks in advance.
Bruce.
swgAre the credentials parameters?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"bwschiek@.hotmail.com" <bwschiekhotmailcom@.discussions.microsoft.com> wrote
in message news:CC286D82-B3E9-48F4-AD5A-ACAB49A19C8B@.microsoft.com...
> Hi:
> We are using SRS to report from a DB2 database running on AS400's. It is
> working very well.
> Pushing ahead, we want to capture information on when certain reports
> (actually letters) are generated. The reports prompt for login
> credentials
> at run time. These DB2 database credentials are passed to the database
> server and the report returns the data just fine. Works great right out
> of
> the box.
> What we would like to do is capture the user name that is passed to the
> database. This is not the Windows AD username that can be obtained by the
> global field
> User!UserID, but the DB2 specific user name that is passed by the ODBC
> connection.
> Can this be captured at runtime? We have reviewed the RS object model and
> haven't found what we are looking for. Are we barking up the wrong tree?
> Thanks in advance.
> Bruce.
> swg|||Hi:
They are not parameters in the sense that they are built into the report as
parameters.
Instead of saving credentials securely on the report server, I selected the
"The credentials supplied by the user running the report." under the "Connect
Using:" portion of the datasource Properties page.
It is that username that the user enters at runtime that I need to capture.
Thanks.
Bruce.
"Bruce L-C [MVP]" wrote:
> Are the credentials parameters?
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "bwschiek@.hotmail.com" <bwschiekhotmailcom@.discussions.microsoft.com> wrote
> in message news:CC286D82-B3E9-48F4-AD5A-ACAB49A19C8B@.microsoft.com...
> > Hi:
> >
> > We are using SRS to report from a DB2 database running on AS400's. It is
> > working very well.
> >
> > Pushing ahead, we want to capture information on when certain reports
> > (actually letters) are generated. The reports prompt for login
> > credentials
> > at run time. These DB2 database credentials are passed to the database
> > server and the report returns the data just fine. Works great right out
> > of
> > the box.
> >
> > What we would like to do is capture the user name that is passed to the
> > database. This is not the Windows AD username that can be obtained by the
> > global field
> > User!UserID, but the DB2 specific user name that is passed by the ODBC
> > connection.
> >
> > Can this be captured at runtime? We have reviewed the RS object model and
> > haven't found what we are looking for. Are we barking up the wrong tree?
> >
> > Thanks in advance.
> >
> > Bruce.
> >
> > swg
>
>|||Oh, I see. Sorry. I am not aware of a way to get this via built in
functionality but how about this. It depends on your database but SQL Server
has a function that returns the user:
SELECT 'The current user is: '+ convert(char(30), CURRENT_USER)
If your database has something similar then have a second dataset that uses
the same data source and get the information that way.-- Bruce Loehle-Conger
MVP SQL Server Reporting Services
"bwschiek@.hotmail.com" <bwschiekhotmailcom@.discussions.microsoft.com> wrote
in message news:FB08FB96-06B5-4E39-A9DA-4929CFC3629E@.microsoft.com...
> Hi:
> They are not parameters in the sense that they are built into the report
> as
> parameters.
> Instead of saving credentials securely on the report server, I selected
> the
> "The credentials supplied by the user running the report." under the
> "Connect
> Using:" portion of the datasource Properties page.
> It is that username that the user enters at runtime that I need to
> capture.
> Thanks.
> Bruce.
> "Bruce L-C [MVP]" wrote:
>> Are the credentials parameters?
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "bwschiek@.hotmail.com" <bwschiekhotmailcom@.discussions.microsoft.com>
>> wrote
>> in message news:CC286D82-B3E9-48F4-AD5A-ACAB49A19C8B@.microsoft.com...
>> > Hi:
>> >
>> > We are using SRS to report from a DB2 database running on AS400's. It
>> > is
>> > working very well.
>> >
>> > Pushing ahead, we want to capture information on when certain reports
>> > (actually letters) are generated. The reports prompt for login
>> > credentials
>> > at run time. These DB2 database credentials are passed to the database
>> > server and the report returns the data just fine. Works great right
>> > out
>> > of
>> > the box.
>> >
>> > What we would like to do is capture the user name that is passed to the
>> > database. This is not the Windows AD username that can be obtained by
>> > the
>> > global field
>> > User!UserID, but the DB2 specific user name that is passed by the ODBC
>> > connection.
>> >
>> > Can this be captured at runtime? We have reviewed the RS object model
>> > and
>> > haven't found what we are looking for. Are we barking up the wrong
>> > tree?
>> >
>> > Thanks in advance.
>> >
>> > Bruce.
>> >
>> > swg
>>

No comments:

Post a Comment