Update: The wrappers mentioned below are released as: DBIx::BulkUtil. Sybase bcp, Oracle sqlldr, and SybaseIQ "LOAD TABLE" are covered.

Go ahead and use bcp, you can even call it from perl. I have wrappers around bcp and sqlldr. No, sorry, I can't share them. Well, here's a bit of the bcp method:

sub bcp_in { my $self = shift; my $opts = (ref $_[-1]) ? pop @_ : {}; my ( $table, $file, $dir ) = @_; # bcp_out is just bcp_in called with $dir = 'out' $file ||= "$table.bcp"; $dir ||= 'in'; ...snip my $pid = open(my $fh, "-|"); confess "Can't fork: $!" unless defined $pid; # UTF-8 doesn't work on HP - default is roman8 unless ($pid) { # Enclose in block so we don't get exec warning my $commit_size = $opts->{CommitSize} || 1000; my @max_errors = $opts->{MaxErrors} ? (-m => $opts->{MaxErrors} ) + : (); my @header_opt = ($opts->{Header} && $dir eq 'in') ? (-F => $opts- +>{Header}+1) : (); {exec("bcp", $bcp_table, $dir, $file, -U => $user, -P => $self->{PASSWORD}, # -J => "utf8", -S => $server, "-c", -t => $delimiter, -r => $row_delimiter, -b => $commit_size, @header_opt, @id_opt, @max_errors, )}; warn "Could not exec bcp: $!\n"; exit 1; } my $rows; local ($_, $.); while (<$fh>) { print; $rows = $1 if /^(\d+) rows copied/; } close $fh; confess "BCP error" unless defined $rows; return $rows; }

In reply to Re: BCP in Sybase::DBLib by runrig
in thread BCP in Sybase::DBLib by prafulltc

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.