473,385 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Newbie with a problem

Hello all!!!


I am learning Perl here at my work, but right now I have a problem, I was reading about DBI, which is very cool since we use a lot of old DBF tables, so I am able to get the DBF data to CSV, but I was wondering is there a way to put it in MySql tables

I have here a small example to turn DBF to CSV but how to make it to MySql table? can you help me?


Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. use DBI;
  5.  
  6. my $dbhX = DBI->connect('dbi:XBase(RaiseError=1):');
  7. my $dbhC = DBI->connect('dbi:CSV(RaiseError=1):');
  8. my $select = $dbhX->prepare("SELECT * FROM reg501");
  9. $select->execute();
  10.  
  11. if (-e "c:/proyecto/xtestcsv.csv")
  12. {
  13.     print "Advertencia el archivo existe iniciando el borrando del mismo ";
  14.          unlink ('c:/proyecto/xtestcsv.csv');
  15. }
  16.  
  17. $dbhC->do("CREATE TABLE xtestcsv.csv AS IMPORT(?)",{},$select);
Oct 22 '07 #1
2 1128
numberwhun
3,509 Expert Mod 2GB
Well, first, you would have to use the mysql DBD. Second, you will need to check the mySql manual and see if itmports the import function you are using. If so, you are in good shape.

Regards,

Jeff
Oct 22 '07 #2
eWish
971 Expert 512MB
I know that you can use the LOAD DATA directly with MySQL to import a CSV file. I don't believe that the DBI supports this method.
Oct 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: wadacom | last post by:
I'm sorry to take your time for newbie problems but I've been searching what to do about the problem with my apache server I have. I work with ubuntu dapperdrake I put the last apache server on it...
0
by: emparc | last post by:
Hello Gurus, I am a newbie to SQL without any formal training (using Navigator 5) and reached a dead-end on trying to figure out the logic and the coding I need to make this work ! Your...
9
by: John | last post by:
Hello all. I am a PHP newbie and am having an issue using the && in an if statement. here is the code: if ($_REQUEST == "1" && date("Y-m-d") < $rowWork) { die("<h1>The earlybird special has...
7
by: idiolect | last post by:
Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band...
0
by: Alan Silver | last post by:
Hello, I'm a newbie at PHP and MySql, although I have wads of experience of ASP, ASP.NET, SQL Server, etc. I have just installed PHP 5.2.3 on a server (Windows Server 2003), as well as MySql...
2
by: James Calivar | last post by:
I'm a newbie trying to write a script that uses threads. I'm right now a little bit stuck in understanding why the code snippet I wrote doesn't seem to be entering the function defined in the...
5
by: Dave | last post by:
I am new to Visual Web Developer 2005 Expres. I am using absolute positioning and every time I add a button control to my web form its width extends all the way to the edge of the page. IOW I...
0
by: Edwin.Madari | last post by:
-----Original Message----- statement prepared first and executed many times with exectemany - db API http://www.python.org/dev/peps/pep-0249/ inline statemets can be exeucuted only. hope that...
0
by: Robert Kern | last post by:
Joe Hays wrote: You will want to ask numpy questions on the numpy mailing list (preferably with a subject line a bit more informative with respect to the actual problem). ...
6
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.