Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problem resoting DB using VC++!!

problem resoting DB using VC++!!

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasesql-serversysadminsecurity
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    venadder
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • V venadder

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you considered either the BACKUP DATABASE or SELECT 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

      V 1 Reply Last reply
      0
      • D David Crow

        Have you considered either the BACKUP DATABASE or SELECT 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

        V Offline
        V Offline
        venadder
        wrote on last edited by
        #3

        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???

        D 1 Reply Last reply
        0
        • V venadder

          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???

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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

          V 1 Reply Last reply
          0
          • D 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

            V Offline
            V Offline
            venadder
            wrote on last edited by
            #5

            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!!!

            D 1 Reply Last reply
            0
            • V venadder

              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!!!

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups