Dumb question, does mysql need an explicit commit? -----Original Message----- From: Aruna Goke [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 20, 2007 2:23 PM To: beginners@perl.org; [EMAIL PROTECTED] Subject: the Database is not updated
Can someone put me thru this? when I run the script..it bring no error.. however, the table radacct is not updated. what have i done wrong. Goksie #!/usr/bin/perl use strict; use warnings; use DBI; my ($fn, @x); #define the file $fn = 'lost.csv'; $/ = "\n"; #prepare a database connection source; my ($data_source, $user, $pass, $ret, $sql, $dbh, $sth, $row, $port, $hostname, $database); $data_source='dbi:mysql:radonet:localhost'; $user='root'; $pass='junkh1a'; $database='radius'; $hostname='localhost'; $port='3306'; $dbh = DBI->connect($data_source, $user, $pass); $sql = "UPDATE radacct SET AcctSessionTime = ?, TrunkIdOut = ?, TrunkIdIn = ? where AcctUniqueId = ?"; $sth = $dbh->prepare($sql); #Open the file open FH, '<', $fn or die "The File $fn Could not be opened: $! \n"; while(<FH>) { #split the file into variables @x =(split/,/)[0,1,2,3,4,5,6]; $sth->execute($x[2], $x[5], $x[4], $x[6]); } # extract from the lost.csv file 19736873001," """"",1,4/18/2007 22:59, 192.168.44.38, 10.0.11.79, 1a88e00c34cb30fa 2.34803E+12,2087316954,0,4/18/2007 23:00, 10.0.11.76, 0.0.0.0, 1ebd35b17bd867f9 2.34803E+12,2087316954,0,4/18/2007 23:00, 10.0.11.76, 0.0.0.0, ab3b78424358b27d 12024227659," """"",0,4/18/2007 23:00, 192.168.44.38, 10.0.11.76, 5a31b839bfc95cd5 4.47904E+11," """"",21,4/18/2007 23:00, 192.168.44.38, 10.0.11.79, 9e95a7a7b6937ff8 12024227659," """"",0,4/18/2007 23:00, 192.168.44.38, 10.0.11.76, 0ef7c2048870a6ef 14506708893," """"",211,4/18/2007 22:57, 192.168.44.38, 10.0.11.79, 6a0056401dcb56a7 12024227659," """"",0,4/18/2007 23:01, 192.168.44.38, 10.0.11.76, d6b154140636378b 19736873001," """"",30,4/18/2007 23:00, 192.168.44.38, 10.0.11.79, b744ff188ed3c7fc 16304971578," """"",0,4/18/2007 23:01, 192.168.44.38, 10.0.11.76, d5d103f66de65ad7 71508831681," """"",0,4/18/2007 23:02, 192.168.44.38, 10.0.11.76, a7b2a292af151634 18137318836," """"",0,4/18/2007 23:02, 192.168.44.38, 10.0.11.76, e166c3a40a08df26 16304971578," """"",0,4/18/2007 23:02, 192.168.44.38, 10.0.11.76, b889cae3a64c3a68 4.47904E+11," """"",81,4/18/2007 23:01, 192.168.44.38, 10.0.11.79, 2f9d50e741fe5f65 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ NOTICE OF CONFIDENTIALITY: Information included in and/or attached to this electronic mail transmission may be confidential. This electronic mail transmission is intended for the addressee(s) only. Any unauthorized disclosure, reproduction, or distribution of, and/or any unauthorized action taken in reliance on the information in this electronic mail is prohibited. If you believe that you have received this electronic mail transmission in error, please notify the sender by reply transmission, or contact [EMAIL PROTECTED], and delete the message without copying or disclosing it. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/