Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-import text file into MySQL?

Status
Not open for further replies.

linmatt

Technical User
May 22, 2002
50
GB
Is it possible to automatically import a text file into mysql? I have responses sent from a web-based form in the form of - Name: Address1: etc, and pick them up with Outlook 2000. They are always the same so I can go on row and column positions. MySQL is running on Linux, so I can save the files into a Samba share on the server and then pick them up from there. I want to be able to import the info straight into MySQL to produce very up-to-date reports which can be automatically generated. I'm not a programmer and don't know php or Perl, but do know a bit of VB and can do basic shell scripting.

I'm using a MS Access front end. (I know, I know - sorry - it's all I got till I get MyODBC running properly with OpenOffice)

Any assistance would be most welcome.

Thanks

Matt
 
There is no mechanism by which a file dropped into a specific place will be auto-imported by MySQL. You must at the very least invoke MySQL's IMPORT DATA INFILE command.

However, IMPORT DATA INFILE will only work on some variant of CSV data. It is not capable of stripping out data based on position in the file.

I strongly recommend that instead of writing a file you just insert the record into MySQL directly through your scripting language.

Want the best answers? Ask the best questions: TANSTAAFL!
 
I may be able to export the file as a csv from the web site. That may work but I've not had a vast amount of experience with MySQL from the Linux side - I use it here on NT4 a fair bit although not from the command line. I'll have a go tonight and see how it goes.

I could run the import from a cron script. Every hour or so would do - we do a similar thing here with SCO, although it's a different database.
 
I would if I knew how!

I'm primarily in support with an interest in programming to the point where it helps me get my job done, and VBA in Excel quite extensively. I'd love to learn php or similar, and properly learn MySQL but don't have the £1500 needed to do it. I find I don't have the discipline to learn too well from books.

The site is one I'm building for my own future use, and want to get it running properly now. There is a MySQL back-end DB run by my ISP that I have access to on my account.

I'm using NetObjects Fusion 5 to build the site (Cos it's what I have and I know how to use it - mostly :) )and it has database components. I'll have to see if I can integrate the two. Then I can export the data from there and import it into my own database on my server at home.

Unless there's a better way....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top