Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

need help

tikue666tikue666 Member Posts: 1
Hi, I'm sorta a newbie to SQL, did some simple projects qith IBM DB2 a few years back, need help on this:

How do I insert records automatically to my database whenever I get new files being saved into a particular folder? (need to insert timestamps and other info of the image files being saved into a folder)

Thanks for the help!

Comments

  • tvientitvienti Member Posts: 230
    You can't do this with MySQL alone. You'd need a script of some sort. Two approaches would be...

    (a) make file saving go through the script, so each time a file is saved (through the script), the script also inserts the info info the DB.

    (b) an easier route, just have a script run every day (or hour, whatever you needs are). Have it get a directory listing, and check it against the DB. Any files found in the directory but not found in the DB can be inserted. You'd need to pull the date from the file info, instead of using now().

    Hope that helps..
    T

    : Hi, I'm sorta a newbie to SQL, did some simple projects qith IBM DB2 a few years back, need help on this:
    :
    : How do I insert records automatically to my database whenever I get new files being saved into a particular folder? (need to insert timestamps and other info of the image files being saved into a folder)
    :
    : Thanks for the help!
    :

  • Danesh_DDanesh_D Member Posts: 9
    : You can't do this with MySQL alone. You'd need a script of some sort. Two approaches would be...
    :
    : (a) make file saving go through the script, so each time a file is saved (through the script), the script also inserts the info info the DB.
    :
    : (b) an easier route, just have a script run every day (or hour, whatever you needs are). Have it get a directory listing, and check it against the DB. Any files found in the directory but not found in the DB can be inserted. You'd need to pull the date from the file info, instead of using now().
    :
    : Hope that helps..
    : T
    :
    : : Hi, I'm sorta a newbie to SQL, did some simple projects qith IBM DB2 a few years back, need help on this:
    : :
    : : How do I insert records automatically to my database whenever I get new files being saved into a particular folder? (need to insert timestamps and other info of the image files being saved into a folder)
    : :
    : : Thanks for the help!
    : :
    :
    :


    Well, maybe I have not understad your question, but I think you should first connect to mysql by calling MySQL library function through a platform, for example MySQL C API and then easily detect when a file has been created into a specified folder (by using a timer and check after each period of time). Then easily send the INSERT INTO query to the server if it is in local machine or remote, it doesn't matter. Fore more information about MySQL libraries visit www.mysql.com and develope center.

    Cheers,

    Danesh






Sign In or Register to comment.