This is my example program.. We have to export our .ods into .csv file. In this below example I have used that exported .csv file.

use strict; use warnings; use Data::Dumper; use DBI; # get the argument from (.csv file) from command line die "File not found\n" if(not defined(@ARGV)); my ($file)=@ARGV; my $flag=0; # connect the data base my $dbh=DBI->connect("DBI:Pg:dbname=sathishkumar","sathishkumar","s +athishkumar",{RaiseError=>1,AutoCommit=>1}); # using this function Check File already Available our database or +not my @Table_Name=$dbh->tables(); foreach(@Table_Name) { if($_ eq "dbi.config_table") { $flag=1; last; } } # Delete the previous row from this file $dbh->do("delete from dbi.config_table") if($flag==1); # Else create the table if($flag==0) { $dbh->do("create table dbi.config_table(id integer,process varc +har,ip varchar,port integer, deamon varchar,log_table varchar)"); } # prepare the Query to execute my $sh=$dbh->prepare("insert into dbi.config_table values(?,?,?,?,?, +?)"); # open the .csv file open FH,"<$file" or die "We can't open this file:$!"; while(<FH>) { chomp; my @line=split(/,/,$_); if($. != 1) { # remove all string delimiter $line[0] =~ s/\"//g; $line[1] =~ s/\"//g; $line[2] =~ s/\"//g; $line[3] =~ s/\"//g; $line[4] =~ s/\"//g; $line[5] =~ s/\"//g; my $id=$line[0]; my $process=$line[1]; my $Ip=$line[2]; my $port=$line[3]; my $Deamon=$line[4]; my $log_file=$line[5]; # execute the prepared Query $sh->execute($id,$process,$Ip,$port,$Deamon,$log_file); } } close FH; # disconnect the Data base. $dbh->disconnect();

In reply to Re: .ods file by leslie
in thread .ods file by jonam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.