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 4:22PM

Michael Peppler wrote:
> 
> Steven Cruz writes:
>  >
>  > > 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.
> 
> I don't see anything wrong, off-hand.
> 
> Are you sending a lot of data to the server?
	
	yes, several million rows. 

> You *could* somehow hit the same sort of bug that we've seen on the
> selects.
> 
> Have you tried using the normal bcp program to upload this data
> instead to see if that works better?

	I am doing that right now. It seems to work fine, however it has not
finished yet.

> In general, because bcp is about 3 times faster than using perl for
> the same thing it is better to use system() and execute bcp to load
> data.

	hmm, I will keep that in mind. 
 
> (which is also why I don't think I'll implement the BLK api anytime
> soon...)

	Thank you very much. I use perl since I also have to some error
checking in the data. But what I have done is created another script to
check all the input  first. 
 
	Thank you for everything.

8-)
Steven Cruz
> Michael
> 
>  >
>  > 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.combegin:vcard
>  > n:cruz';'steven
>  > tel;home:416-516-4652  (work 2)
>  > tel;work:416-364-9557-107
>  > x-mozilla-html:TRUE
>  > org:Nextopia Software
>  > version:2.1
>  > email;internet:steve@nextopia.com
>  > title:Depends on what day
>  > note:8-)
>  > adr;quoted-printable:;;Current=0D=0Anextopia software corporation=0D=0A142 adelaide street east, 3rd floor=0D=0Atoronto, ontario=0D=0Am5c 1k9=0D=0A=0D=0ALong Term-=0D=0A116 lansdowne Ave Unit 3=0D=0AToronto ONT=0D=0AM6K 2C9=0D=0A;Toronto;Ontario;M6K 2C9;Canada
>  > x-mozilla-cpt:;96
>  > fn:'steven cruz'
>  > end:vcard
> 
> --
> 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