473,666 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie with a problem

5 New Member
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 1149
numberwhun
3,509 Recognized Expert Moderator Specialist
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 Recognized Expert Contributor
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
4674
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 and I tried to put the mod_python module to work. the only answer I got was that apache didn't find api structure in the module. afterwards I read I didn't need this module to work with python (only a speed difference as I understand) but the problem...
0
892
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 assistance is GREATLY appreciated ! heres my problem.... I need to segregate all the records in the cabinet based on the LAST_DATE that that a cabinet was opened (before April 2007) and all records ( recs_import_date ) not touched by cabinet on or before...
9
1471
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 ended.</h1>"); }
7
1508
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 value per pixel, and set it to something else if it meets or falls below a certain threshold - i.e., a Red value of 0 would be changed to 50. I've built my list by using a Python Image Library statement akin to the following:
0
1126
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 5.0.45. Both of these work fine independently, but I can't get PHP to connect to MySql. The first (and probably most basic) problem is that when I run phpinfo()
2
975
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 start_new_thread() call. If I run it as is (the threaded version), the output is: UA_1 configuring... UA_1 halting..
5
1395
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 get a long skinny button that extends to the right side of the browser. This does not appear to happen with other controls. Any idea why it happens to the button? Here is how the button looks in source code:
0
1713
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 helps Edwin
0
1208
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). http://www.scipy.org/Mailing_Lists In this case, the problem is that * does not do matrix multiplication; it does element-wise multiplication. Use dot(A, randn(n,1)) instead.
6
11479
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
0
8785
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8560
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6200
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.