473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

using application roles

Hello,

I am looking to have the developers at my company start to use
application roles to gain access to SQL. The basics seem simple, add the
role to the database, use sp_setapprole to activate it.

My question is most likely really simple as well...

How do you tell the application which SQL server you want to EXEC
sp_setapprole against?

i.e. do you need to establish an OLEDB connection before calling
sp_setapprole? Seems strange to have to establish a connection twice,
but I can't think of how else to do it. But I think I'm missing
something...

Thanks in advance!

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
9 3054
> i.e. do you need to establish an OLEDB connection before calling
sp_setapprole? Seems strange to have to establish a connection twice,
but I can't think of how else to do it. But I think I'm missing
something...
Yes, you need to first establish a connection before your execute
sp_setapprule. This validates the user's login against the target SQL
Server. Once connected, execute sp_setapprole on the open connection to
activate the app role. Only one connection is established.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"tgru" <tg**@devdex.com> wrote in message news:42********@127.0.0.1... Hello,

I am looking to have the developers at my company start to use
application roles to gain access to SQL. The basics seem simple, add the
role to the database, use sp_setapprole to activate it.

My question is most likely really simple as well...

How do you tell the application which SQL server you want to EXEC
sp_setapprole against?

i.e. do you need to establish an OLEDB connection before calling
sp_setapprole? Seems strange to have to establish a connection twice,
but I can't think of how else to do it. But I think I'm missing
something...

Thanks in advance!

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 23 '05 #2
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #4
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #6
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #7
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #8
This sucks... It keeps re-posting my thread every ten minutes. I've
emailed support for the site about it. Sorry about that, not intentional
spamming!!

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #9
> What credentials are used in the connection string?

One usually uses the normal user credentials for the initial connection in
order to validate the current user identity. You can either specify a
trusted connection (e.g. 'Integrated Security=SSPI') or the user's SQL login
(e.g. 'User Id=MyLogin;Password=MyPassword'). The specified account needs
to be granted access to SQL Server and your user database. However, no
object permissions need be granted to the user since you granted all
necessary permissions to the app role.

An advantage of app roles is that the login's original identity is
maintained (e.g. 'SELECT SUSER_SNAME()') but the security context of the app
role is used for database access. This works especially well with Windows
authentication because the user is not prompted to login and you can still
limit ad-hoc database access.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"tgru" <tg**@devdex.com> wrote in message news:42********@127.0.0.1...
Thanks, that does help.

What credentials are used in the connection string? i.e. does a login
have to be created for the application as well? Or is the connection
string created with the application users credentials? Seems that you
would have to manage the individual users logins as well as the app role
at that point...

1.) establish oledb connection with SQL login credentials.
2.) call sp_setapprole with app role credentials.

I don't know why the original message in this thread keeps getting
posted every ten minutes!!! I only hit submit once, and then closed
that browser session!!
Thanks,

TGru

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DCount17 | last post by:
I need to create a windows application (using C#) that creates/assigns and retrieves database roles on Analysis Services. While I can get the users from the "Members" table on SQL Server, I am...
2
by: YRao | last post by:
I am going to create intranet application using Windows Authentication using C# asp.net I am having following problem: 1 setting windows Authentication, it will validate for all users, user...
4
by: tommy | last post by:
hello everbody, i write a little asp-application with forms-authentication. i copy my aspx-files with web.config to my webspace and i get the error above... i tried to set the...
5
by: Jonathan Allen | last post by:
Is this the correct way to use application roles? Public Function GetDBConnection() As SqlConnection Dim oCon As New SqlConnection(myConnectionString) oCon.Open() Using oCmd As SqlCommand =...
3
by: Carl M. | last post by:
Okay, I'm 18 hours into this now and am at a loss. What I've done is create an application on my local workstation using VWD Express using the membership/roles provider and SQL Server Express...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
6
by: Matt Adamson | last post by:
Guys, I'm unsure how to use windows authentication in an intranet application. I'd like to user existing windows account to identify users however the issue I have is how to then add settings to...
2
by: CuteDeveloper | last post by:
Hi everybody! I can not understand how to use SQL2005 Appicatioin Roles (AR) with ASP.NET 2.0? The tricky thing here is that you have to set up your connection string to use integrated...
2
by: Vincent | last post by:
Hi, When the application doesn't use Roles, this configuration (web.config) works: <configuration> <connectionStrings> <clear/> <add name="myconn" connectionString="Data...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.