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. Visual Basic
  4. loading files to server

loading files to server

Scheduled Pinned Locked Moved Visual Basic
databasesql-serversysadmintestingbeta-testing
8 Posts 4 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.
  • J Offline
    J Offline
    jishbalan
    wrote on last edited by
    #1

    Hello friends, I am Usind MSAccess for loading some txtfiles from a folder to the SQL server. These txtfiles are gnerated from a testing tool. My Access will autoload the files to the server i.e my application is scheduled to call from scheduled task, twice a day. It will check the folder for txtfiles , if the folder is empty, the applicaton exits. Else it will load the files to server and move all loaded files to another folder. My problem is if both tool(my MSAccess and the testing tool which creating txt files) are running simultanously these is a chance of half generated txt file(generating by testing tool) to be loaded in the server. I dont want that. That file has to be loaded next time. How to prevent the half generated txtfiles from loading to server. Hope u got my problem Regards Jishith

    A D M 3 Replies Last reply
    0
    • J jishbalan

      Hello friends, I am Usind MSAccess for loading some txtfiles from a folder to the SQL server. These txtfiles are gnerated from a testing tool. My Access will autoload the files to the server i.e my application is scheduled to call from scheduled task, twice a day. It will check the folder for txtfiles , if the folder is empty, the applicaton exits. Else it will load the files to server and move all loaded files to another folder. My problem is if both tool(my MSAccess and the testing tool which creating txt files) are running simultanously these is a chance of half generated txt file(generating by testing tool) to be loaded in the server. I dont want that. That file has to be loaded next time. How to prevent the half generated txtfiles from loading to server. Hope u got my problem Regards Jishith

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      One way is to check the file size, wait say 10 seconds and check it again. Repeat until there is no change. Hope this helps

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • J jishbalan

        Hello friends, I am Usind MSAccess for loading some txtfiles from a folder to the SQL server. These txtfiles are gnerated from a testing tool. My Access will autoload the files to the server i.e my application is scheduled to call from scheduled task, twice a day. It will check the folder for txtfiles , if the folder is empty, the applicaton exits. Else it will load the files to server and move all loaded files to another folder. My problem is if both tool(my MSAccess and the testing tool which creating txt files) are running simultanously these is a chance of half generated txt file(generating by testing tool) to be loaded in the server. I dont want that. That file has to be loaded next time. How to prevent the half generated txtfiles from loading to server. Hope u got my problem Regards Jishith

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        In the old days (VAX/VMS) I used to be able to open a file either as "Shared" or "Exclusive". What you want here is to open the file, "Exclusive", so that you are guaranteed that that no other process is touching it. You will need to test this out with OpenTextFile in MS-Access. Just and idea.

        1 Reply Last reply
        0
        • J jishbalan

          Hello friends, I am Usind MSAccess for loading some txtfiles from a folder to the SQL server. These txtfiles are gnerated from a testing tool. My Access will autoload the files to the server i.e my application is scheduled to call from scheduled task, twice a day. It will check the folder for txtfiles , if the folder is empty, the applicaton exits. Else it will load the files to server and move all loaded files to another folder. My problem is if both tool(my MSAccess and the testing tool which creating txt files) are running simultanously these is a chance of half generated txt file(generating by testing tool) to be loaded in the server. I dont want that. That file has to be loaded next time. How to prevent the half generated txtfiles from loading to server. Hope u got my problem Regards Jishith

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          We use a first pass flag. We know the write does not take more than x seconds so the loop sets a time flag the first pass. Second pass if the time flag is > wait setting then the file is loaded. I almost like the exclusive idea (and will test it Monday) except you are programming by error (one of my favourite rants) ie try and open the file, if it fails then deal with it.

          Never underestimate the power of human stupidity RAH

          J 1 Reply Last reply
          0
          • M Mycroft Holmes

            We use a first pass flag. We know the write does not take more than x seconds so the loop sets a time flag the first pass. Second pass if the time flag is > wait setting then the file is loaded. I almost like the exclusive idea (and will test it Monday) except you are programming by error (one of my favourite rants) ie try and open the file, if it fails then deal with it.

            Never underestimate the power of human stupidity RAH

            J Offline
            J Offline
            jishbalan
            wrote on last edited by
            #5

            the txt file may take minute for complete write.. And its with the customer side..i dont want to fail my application while opening..Want to load other file skipping the file which is still in writing process..

            M 1 Reply Last reply
            0
            • J jishbalan

              the txt file may take minute for complete write.. And its with the customer side..i dont want to fail my application while opening..Want to load other file skipping the file which is still in writing process..

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              jishbalan wrote:

              Want to load other file skipping the file which is still in writing process.

              That is precisely what we do. If the file has not been resident in the folder for #n seconds then the loop progresses to the next file in the folder and ignores the potentially locked file. Next pass it will get the file it ignored.

              Never underestimate the power of human stupidity RAH

              J 1 Reply Last reply
              0
              • M Mycroft Holmes

                jishbalan wrote:

                Want to load other file skipping the file which is still in writing process.

                That is precisely what we do. If the file has not been resident in the folder for #n seconds then the loop progresses to the next file in the folder and ignores the potentially locked file. Next pass it will get the file it ignored.

                Never underestimate the power of human stupidity RAH

                J Offline
                J Offline
                jishbalan
                wrote on last edited by
                #7

                Thanks a lot.. These is exactly what i want... But "If the file has not been resident in the folder for #n seconds" What it means? and how to check? "potentially locked file" How can i check for these?

                M 1 Reply Last reply
                0
                • J jishbalan

                  Thanks a lot.. These is exactly what i want... But "If the file has not been resident in the folder for #n seconds" What it means? and how to check? "potentially locked file" How can i check for these?

                  M Offline
                  M Offline
                  Mycroft Holmes
                  wrote on last edited by
                  #8

                  You need a table/list of filenames with a datetime field. Start loop (foreach file in directory) check if the file is in the list add the file to the list with the time (first pass) if the file is there has enough time passed (check time flag in list for this file) if time passed > Setting then process end loop A potentially locked file has been in the folder less than #n seconds/minutes. You really don't care if it is actually locked, just make sure the time to wait is > than any possible locking period.

                  Never underestimate the power of human stupidity RAH

                  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