PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Steven Cruz <steve at nextopia dot com>
Subject: Re: BCP hangs
Date: Jun 22 1999 3:37PM

> I think we need to see the script, or (better) a minimal case that
> illustrates the problem.
> 
> Off-hand like this it's just about impossible to determine what may be
> wrong.

	Unfortunately it occurs randomly. :(

But here is the part that  sends the rows to SQL server. 

Thank you 
Steven Cruz


sub commit_rows
{
        my($table_name,$col_count,$all_table)=@_;
        my(@tdata);
        my($temp,$ret,$res,$count);
        my($debug)=0;
        my($uid,$pwd,$srvnme,$app_name,$dbh);

        $uid="xxx";
        $pwd="yyy";
        $srvnme="zzz";
        
        &BCP_SETL(TRUE);
        $dbh=new Sybase::DBlib($uid,$pwd,$srvnme);

        $dbh->bcp_init("mydb..$table_name", "","load_error.log", DB_IN);
        $dbh->bcp_meminit($col_count);

        foreach $temp (@$all_table)
        {
                @tdata=split(/\|/,$temp);
                if ($debug)
                {
                        my($bleek,$fcounter);

                        $fcounter=0;
                        foreach $bleek (@tdata)
                        {
                                $fcounter++;
                                print "Field $fcounter: $bleek \n";
                        }
                }

                $dbh->bcp_sendrow(\@tdata);
                $count++;

                if(($count % 10) == 0)
                {
                        #print "10 rows sent table $table_name\n";
                        $dbh->bcp_batch;
                }
                if(($count % 1000) == 0)
                {
                        print "1000 rows sent table $table_name count is
$count \n";
                        print  join(" ",@tdata),"\n";
                        #$dbh->bcp_batch;
                }
        }

        $dbh->bcp_batch;
        $ret = $dbh->bcp_done;
        print "commit of table $table_name with res $ret\n";
}

 
> Michael
> --
> Michael Peppler         -||-  Data Migrations Inc.
> mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
> Int. Sybase User Group  -||-  http://www.isug.com
> Sybase on Linux mailing list: ase-linux-list@isug.com