Showing posts with label denied. Show all posts
Showing posts with label denied. Show all posts

Friday, February 17, 2012

Database permission error

Windows Pro
Receiving the following error:
CREATE DATABASE permission denied in database 'master'. Could not attach
database 'pubs' to file 'D:\Program Files\Microsoft SQL
Server\MSSQL$NETSDK\Data\pubs.mdf'.
Here are some things done to try to resolve the problem:
Reboot 4-5 times
Shared out the folder
Web shared the folder
Thanks for your help,
T.Are you connecting with a trusted connection or as sa. It sounds like you
do not have the access required to create a database. Make sure you are
connecting in as a member of the Administrators group on that machine so you
become part of the sysadmin (aka System Administrators) role. At a minimum
you need the dbcreator role level access. Running
sp_helpsrvrolemember 'sysadmin'
-- or --
sp_helpsrvrolemember 'dbcreator'
will tell you who belongs to these roles. Looking at the Query window title
bar will tell you who you are logged in as.
<servername>.<database name>.<loginname> or <DOMAIN>\<username> (for Win NT
authentication)
Reboot and sharing the folder will not help. You might want to check the NT
permissions though.
****************************************
***************************
Andy S.
MCSE NT/2000, MCDBA SQL 7/2000
andymcdba1@.NOMORESPAM.yahoo.com
Please remove NOMORESPAM before replying.
Always keep your antivirus and Microsoft software
up to date with the latest definitions and product updates.
Be suspicious of every email attachment, I will never send
or post anything other than the text of a http:// link nor
post the link directly to a file for downloading.
This posting is provided "as is" with no warranties
and confers no rights.
****************************************
***************************
"Taishi" <taishi_bak@.hotmail.com> wrote in message
news:%23ZocZIy6DHA.2568@.TK2MSFTNGP10.phx.gbl...
quote:

> Windows Pro
> Receiving the following error:
> CREATE DATABASE permission denied in database 'master'. Could not attach
> database 'pubs' to file 'D:\Program Files\Microsoft SQL
> Server\MSSQL$NETSDK\Data\pubs.mdf'.
> Here are some things done to try to resolve the problem:
> Reboot 4-5 times
> Shared out the folder
> Web shared the folder
>
> Thanks for your help,
> T.
>
>
|||Andy,
I am new to SQL. It was hard just to figure out how to install it.
I know I am logged in as a Admin. in Windows.
I have the little server box with the round circle on it in the bottom right
corner(toolbar). The SQL Server Service Manager.
I tried to search for the sp_helpsrvrolemember command on my drive. It's
not on the server.
Any ideas?
Thanks for your help,
T
"Andy Svendsen" <andymcdba1@.NOMORESPAM.yahoo.com> wrote in message
news:#3883ky6DHA.2628@.TK2MSFTNGP10.phx.gbl...
quote:

> Are you connecting with a trusted connection or as sa. It sounds like you
> do not have the access required to create a database. Make sure you are
> connecting in as a member of the Administrators group on that machine so

you
quote:

> become part of the sysadmin (aka System Administrators) role. At a

minimum
quote:

> you need the dbcreator role level access. Running
> sp_helpsrvrolemember 'sysadmin'
> -- or --
> sp_helpsrvrolemember 'dbcreator'
> will tell you who belongs to these roles. Looking at the Query window

title
quote:

> bar will tell you who you are logged in as.
> <servername>.<database name>.<loginname> or <DOMAIN>\<username> (for Win

NT
quote:

> authentication)
>
> Reboot and sharing the folder will not help. You might want to check the

NT
quote:

> permissions though.
> --
> ****************************************
***************************
> Andy S.
> MCSE NT/2000, MCDBA SQL 7/2000
> andymcdba1@.NOMORESPAM.yahoo.com
> Please remove NOMORESPAM before replying.
> Always keep your antivirus and Microsoft software
> up to date with the latest definitions and product updates.
> Be suspicious of every email attachment, I will never send
> or post anything other than the text of a http:// link nor
> post the link directly to a file for downloading.
> This posting is provided "as is" with no warranties
> and confers no rights.
> ****************************************
***************************
> "Taishi" <taishi_bak@.hotmail.com> wrote in message
> news:%23ZocZIy6DHA.2568@.TK2MSFTNGP10.phx.gbl...
>

Database Permission

Could someone please tell me how I can trap permission errors in
vb.net on a stored procedure:
ie. Execute permission denied on object 'sel_mytable', database
'mydatabase', owner 'dbo'

I would like to print a message like
response.write("You don't have permission to select on this table") as
opposed to the cryptic message I am receiving.

Thanks in advance
Julie BarnetYou can trap a SqlException and translate the error as desired in your code.
VB.Net WinForm example:

Try
sqlCommand.ExecuteReader()
Catch ex As SqlException
Dim PermissionError As Boolean = False
For Each sqlError As SqlError In ex.Errors
If sqlError.Number = 229 Then
PermissionError = True
Exit For
End If
Next sqlError
If PermissionError = True Then
MessageBox.Show("You don't have permission to select on this
table")
Else
MessageBox.Show("Unexpected error: " & ex.ToString())
End If
End Try

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Julie Barnet" <barnetj@.pr.fraserpapers.com> wrote in message
news:438e1811.0312081052.d233a1f@.posting.google.co m...
> Could someone please tell me how I can trap permission errors in
> vb.net on a stored procedure:
> ie. Execute permission denied on object 'sel_mytable', database
> 'mydatabase', owner 'dbo'
> I would like to print a message like
> response.write("You don't have permission to select on this table") as
> opposed to the cryptic message I am receiving.
> Thanks in advance
> Julie Barnet|||I am databinding a datagrid. I tried that and it still doesn't seem
to work. I will paste my code...

Is there something I'm missing?

Public Function BindGrid(ProcName as String, myDataGrid as
DataGrid, cmd as SqlCommand, con as SqlConnection) as Integer
Dim ds As DataSet
Dim da As new SqlDataAdapter()

Try

cmd.CommandText = ProcName
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = con

da.Selectcommand = cmd

ds = new DataSet()
da.Fill(ds, "MyTable")

myDataGrid.DataSource=ds.Tables("MyTable").DefaultView
myDataGrid.DataBind()
return ds.Tables("MyTable").Rows.Count

catch exp as SqlException
HttpContext.Current.Response.Write("Exception3")

End Try
End Function|||I ran your code and got the "Exception3" message. What symptoms are you
getting?

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Julie Barnet" <barnetj@.pr.fraserpapers.com> wrote in message
news:438e1811.0312090444.3e7dd4ab@.posting.google.c om...
> I am databinding a datagrid. I tried that and it still doesn't seem
> to work. I will paste my code...
> Is there something I'm missing?
> Public Function BindGrid(ProcName as String, myDataGrid as
> DataGrid, cmd as SqlCommand, con as SqlConnection) as Integer
> Dim ds As DataSet
> Dim da As new SqlDataAdapter()
> Try
> cmd.CommandText = ProcName
> cmd.CommandType = CommandType.StoredProcedure
> cmd.Connection = con
> da.Selectcommand = cmd
> ds = new DataSet()
> da.Fill(ds, "MyTable")
> myDataGrid.DataSource=ds.Tables("MyTable").DefaultView
> myDataGrid.DataBind()
> return ds.Tables("MyTable").Rows.Count
>
> catch exp as SqlException
> HttpContext.Current.Response.Write("Exception3")
> End Try
> End Function