|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SMO SqlExpress Create Database DatafileI am using SMO to create a database. I use the datafile and logfile objects
to define the data and log files. If I use the sqlserverobject.Information.MasterDBPath as the file location it is able to create the database. But if an attempt is made to locate the datafiles in another folder, it fails with permission denied. Using windows auth all around and the current user is an Admin on the box. I believe I need to use the credential and login objects to allow sqlserver to access other folders. But I do not understand the cryptic smo object documentation. Also can not find any example code that uses these objects during the initial creation of a database. Thank You. -- Robert Hill Hello,
I suggest that you refer to the following information: How to: Create, Alter, and Remove a Database in Visual Basic .NET http://msdn2.microsoft.com/en-us/library/ms162576.aspx How to: Add FileGroups and DataFiles to a Database in Visual Basic .NET http://msdn2.microsoft.com/en-us/library/ms162176.aspx How to: Create, Alter, and Remove a Log File in Visual Basic .NET http://msdn2.microsoft.com/en-us/library/ms162135(en-US,SQL.90).aspx How to: Set Various Properties Before an Object is Created in Visual Basic .NET http://msdn2.microsoft.com/en-us/library/ms162174(en-US,SQL.90).aspx I hope the information is helpful. Sophie Guo Microsoft Online Partner Support Get Secure! - www.microsoft.com/security ===================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ===================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Thank you for responding.
These links all are good, but they all fall under the 'its works' area of my original question. These examples create the database files in the default location of "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\datafile2.ndf" which seems to qualify as a allowed location. -- Show quoteRobert Hill "Sophie Guo [MSFT]" wrote: > Hello, > > I suggest that you refer to the following information: > > How to: Create, Alter, and Remove a Database in Visual Basic .NET > http://msdn2.microsoft.com/en-us/library/ms162576.aspx > > How to: Add FileGroups and DataFiles to a Database in Visual Basic .NET > http://msdn2.microsoft.com/en-us/library/ms162176.aspx > > How to: Create, Alter, and Remove a Log File in Visual Basic .NET > http://msdn2.microsoft.com/en-us/library/ms162135(en-US,SQL.90).aspx > > How to: Set Various Properties Before an Object is Created in Visual Basic > .NET > http://msdn2.microsoft.com/en-us/library/ms162174(en-US,SQL.90).aspx > > I hope the information is helpful. > > Sophie Guo > Microsoft Online Partner Support > > Get Secure! - www.microsoft.com/security > > ===================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ===================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. > > Hello,
Based on my test, to create database files successfully, the SQL server service account need have the permissions to create the file on the folder which you want to place data file. To narrow down the issue, I suggest that you set SQL server service account to be a domain user account, grant full control permission on the folder to the domain user account and test the issue again. I hope the information is helpful. Sophie Guo Microsoft Online Partner Support Get Secure! - www.microsoft.com/security ===================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ===================================================== This posting is provided "AS IS" with no warranties, and confers no rights. The SQL Server service account needs to have the rights to create the file,
not the invoking user, since the NT security token is not being propagated on CREATE DATABASE. Ge***@SQLDev.Net Please reply only to the newsgroups. This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. Copyright © SQLDev.Net 1991-2005 All rights reserved. Show quote "RobertHillEDS" <rwhill@nospam.nospam> wrote in message news:706DF6CC-A76F-4D40-B5AF-968B77980E04@microsoft.com... >I am using SMO to create a database. I use the datafile and logfile >objects > to define the data and log files. If I use the > sqlserverobject.Information.MasterDBPath as the file location it is able > to > create the database. But if an attempt is made to locate the datafiles in > another folder, it fails with permission denied. Using windows auth all > around and the current user is an Admin on the box. I believe I need to > use > the credential and login objects to allow sqlserver to access other > folders. > But I do not understand the cryptic smo object documentation. Also can > not > find any example code that uses these objects during the initial creation > of > a database. > > Thank You. > > > -- > Robert Hill
Other interesting topics
|
|||||||||||||||||||||||