problem resoting DB using VC++!!
-
Hi, Here is the scenerio. sql server runs on computer myserver. The application myapp (VC++ MFC) runs on another computer on LAN appComputer. I need to restore the db mydb from myapp. The back file is on appcomputer. So, when db tries to restore from thsi file it cannot access it cuz of security. So i create a share in code myshare on teh folder containing the backupfile. The Db still cannot access it. But if I right click on teh folder and go to security taba nd add everyone to the list and provide full control to everyone it works fine. Now am using sharing api fucntion netshareadd to add the share on the folder temporarily. i went through the documentation of netshareadd but it does not provide any hints on how to add evryone to the security list in code. sdoes anyone has idea how to do this?? thnaks in advance
-
Hi, Here is the scenerio. sql server runs on computer myserver. The application myapp (VC++ MFC) runs on another computer on LAN appComputer. I need to restore the db mydb from myapp. The back file is on appcomputer. So, when db tries to restore from thsi file it cannot access it cuz of security. So i create a share in code myshare on teh folder containing the backupfile. The Db still cannot access it. But if I right click on teh folder and go to security taba nd add everyone to the list and provide full control to everyone it works fine. Now am using sharing api fucntion netshareadd to add the share on the folder temporarily. i went through the documentation of netshareadd but it does not provide any hints on how to add evryone to the security list in code. sdoes anyone has idea how to do this?? thnaks in advance
Have you considered either the
BACKUP DATABASE
orSELECT INTO
commands? http://www.warriorforum.com/forum/topic.asp?TOPIC\_ID=28236
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Have you considered either the
BACKUP DATABASE
orSELECT INTO
commands? http://www.warriorforum.com/forum/topic.asp?TOPIC\_ID=28236
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
well the database is already backup to a file. So backup datatbase is a no no. Select Into returns one row of results, again unrelated to my problem. What I want is to restore my database froma backup file on a remote machine on LAN. This is doen by stored procedure using Restore Database blah from disk = path now if path specifies a computer on LAn then it is like \\servername\drivename$\folder\file.dat here SQL Server gives up since it does not have access to that drive. So to provide access i create a temporary share on the said folder using sharing api function netshareadd. It works fine but Server still cannot access cuz only certain people have rights. So if i manually right click on the folder and go to security tab and add everyone to the list, SQL Server is happy, since it has access not. The problem is how to do the same step in code. Any suggestions???
-
well the database is already backup to a file. So backup datatbase is a no no. Select Into returns one row of results, again unrelated to my problem. What I want is to restore my database froma backup file on a remote machine on LAN. This is doen by stored procedure using Restore Database blah from disk = path now if path specifies a computer on LAn then it is like \\servername\drivename$\folder\file.dat here SQL Server gives up since it does not have access to that drive. So to provide access i create a temporary share on the said folder using sharing api function netshareadd. It works fine but Server still cannot access cuz only certain people have rights. So if i manually right click on the folder and go to security tab and add everyone to the list, SQL Server is happy, since it has access not. The problem is how to do the same step in code. Any suggestions???
So how about the
RESTORE DATABASE
command?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
So how about the
RESTORE DATABASE
command?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
That's exactly what doe snot work! when a RESTORE DATABASE is given a path to file on remote computerr it fails because SQL Server does not have access to the folder!!!
Sorry, I did not see that (unhighlighted) command mentioned in your second post. This sounds more like a SQL issue rather than a C++ issue. Do you agree? Have you consulted the microsoft.public.sqlserver.* newsgroups?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow