Re: SQL Server Application Roles

From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 11/20/05


Date: Sun, 20 Nov 2005 06:16:05 -0600

I assume you are using SQL 2000. Application roles have been deprecated in
SQL Server 2005.

You need a single-quote after the password literal. Also, when you use
application roles, consider disabling connection pooling.

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"Jonathan Allen" <x@x.x> wrote in message 
news:eeb26qV7FHA.3388@TK2MSFTNGP11.phx.gbl...
> Allow me to restate my question.
>
> What the hell is the right way to use application roles from VB/C#? When I 
> try the below code, I get an exception the second time I call 
> GetDBConnection.
>
> -- 
> Jonathan Allen
>
>
> "Jonathan Allen" <x@x.x> wrote in message 
> news:eF4AhZV7FHA.472@TK2MSFTNGP15.phx.gbl...
>> 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 = oCon.CreateCommand
>>        oCmd.CommandText = "IF NOT User_NAME() = 'app_name' Exec 
>> sp_setapprole 'app_name' ,'password"
>>        oCmd.ExecuteNonQuery()
>>    End Using
>> Return oCon
>>
>> What is a good way to embed/encrypt the application role's password in 
>> the program?
>>
>> -- 
>> Jonathan Allen
>>
>>
>>
>>
>
>