Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old June 1st, 2000, 07:36 PM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Is it possible to transfer flat file to MySQL database?
I have some flat file like this:
name::lname::address::email::comment
And I would like to transfer it all to MySQL since file has grown to 8 MB
Do you now for any script that does all the job?
Thanks

Reply With Quote
  #2  
Old June 2nd, 2000, 01:59 AM
donarb donarb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Location: Seattle
Posts: 133 donarb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
You could use the mysqlimport utility to read in a flat file. Using one of the options to the import utility, you can specify a string that delimits your fields:

mysqlimport -u user -ppassword --fields-terminated-by='::' dbname flatfile.txt

Or you could write a quick perl script that dumps your flatfile into INSERT statements, then feed that file into the mysql utility with the stdin redirect:

mysql -u user -ppassword dbname < sqlstuff.txt

You have to make sure that the database exists in MySQL before you use either of those methods. If you use the INSERT statement file, you could define your database before the INSERT statements.

Don

[This message has been edited by donarb (edited June 02, 2000).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Flat file database to MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway