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: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: blk_init and image columns
Date: Sep 5 2002 10:36AM

Have you tried setting CS_OPT_TEXTSIZE to a smaller value, to see what
happens?

I just looked at the code, and the place where I would *guess* that it
dies is in the following loop:

    for(i = 0; i < num_cols; ++i) {
	ret = blk_describe(info->bcp_desc, i+1, &info->datafmt[i]);
	if(ret != CS_SUCCEED)
	    goto FAIL;
    }

I haven't tried to reproduce it, but the CTlib/t/xblk.t test script
*does* insert data to an image column, so it *should* work.

My laptop runs linux (with sybase on it, of course :-), so I may try to
reproduce it here.

Michael

On Wed, 2002-09-04 at 14:10, Stephen.Sprague@morganstanley.com wrote:
> Thanks Michael for replying. Revisiting, as  things  would  have  it,  I
> still am croaking with a SEGV.  Any further pointers most welcome.
> 
> If it helps any here's my perl code fragment:
> 
> 
> #create handle
>   my ($cs, $packetsize) = ('iso_1', 8192);
>   my $props = { CON_PROPS => { CS_BULK_LOGIN => CS_TRUE,
>                                CS_SYB_CHARSE=> $cs,
>                                CS_PACKETSIZE => $packetsize } };
>   my $dbh = Sybase::CTlib->new( $u, $p, $s, $programName, $props );
> 
> 
> #set textsize to 1gb
>   $dbh->ct_options(CS_SET, CS_OPT_TEXTSIZE, 1_000_000_000, CS_INT_TYPE);
> 
> 
> #init blk copy
>    $dbh->blk_init( $tab, $num_cols, $has_identity, $id_column )
> 
> Signal SEGV
> 
> 
> The table on the 11.9 server looks like this I'm trying to bcp into:
> 
>  Column_name     Type            Length Prec Scale Nulls Default_name    Rule_name       Identity
>  --------------- --------------- ------ ---- ----- ----- --------------- --------------- --------
>  i               image               16 NULL  NULL     0 NULL            NULL                   0
> 
> 
> 
> 
> 
> 
> On 4 Sep 2002 @ 8:05am, an entity claiming to be Michael Peppler scribbled:
> 
> mpeppl :[I'm traveling - currently in England - so email access is spotty... ]
> mpeppl :
> mpeppl :CS_PACKETSIZE must be set in a power of 2, starting at 512 (so 512,
> mpeppl :1024, 2048, etc). I think there's a max, and of course the server has to
> mpeppl :be configured to handle larger packet sizes (at least up to 12.0 - 12.5
> mpeppl :*may* handle this dynamically).
> mpeppl :
> mpeppl :However, I'm pretty sure that the packet size has nothing to do with the
> mpeppl :SEGV that you are seeing. I suspect instead that it may be linked with
> mpeppl :the TEXTSIZE value. You can set this via SET TEXTSIZE xxxx or via a
> mpeppl :ct_option() call.
> mpeppl :
> mpeppl :Michael
> mpeppl :
> mpeppl :
> mpeppl :On Fri, 2002-08-30 at 13:39, Stephen.Sprague@morganstanley.com wrote:
> mpeppl :> sorry. last email for the weekend.  I set CS_PACKETSIZE => 9000 via
> mpeppl :> CON_PROPS and I still SEGV'ed on the blk_init.
> mpeppl :>
> mpeppl :> Time to set this thing down and grab a beer.
> mpeppl :>
> mpeppl :> Cheers,
> mpeppl :> Steve
> mpeppl :>
> mpeppl :>
> mpeppl :>
> mpeppl :> On Fri, 30 Aug 2002 @ 4:23pm, an entity claiming to be Stephen.Sprague@morg...:
> mpeppl :>
> mpeppl :> Stephe :Ahhh. Digging further I'm pretty sure this can be solved  by  increasing
> mpeppl :> Stephe :the CS_PACKETSIZE connection property. Now if only I had sa priv to bump
> mpeppl :> Stephe :the max size up from 512 on the server...
> mpeppl :> Stephe :
> mpeppl :> Stephe :Thanks,
> mpeppl :> Stephe :Steve
> mpeppl :> Stephe :
> mpeppl :> Stephe :cf http://www.sybase.com/detail/1,6904,954,00.html
> mpeppl :> Stephe :
> mpeppl :> Stephe :On most platforms, the packet size defaults to 512 bytes.  This  default
> mpeppl :> Stephe :is provided for backward compatibility. Larger packet sizes 2048 to 4096
> mpeppl :> Stephe :bytes, for example almost  always  yield  better  performance.  This  is
> mpeppl :> Stephe :generally true for applications that fetch rows with large columns, rows
> mpeppl :> Stephe :with lots of columns, or lots of rows with a few small  columns.  It  is
> mpeppl :> Stephe :especially true for applications that do bulk  copy  data  transfers  or
> mpeppl :> Stephe :that handle text and image data.
> mpeppl :> Stephe :
> mpeppl :> Stephe :To increase a connection's packet size, set the CS_PACKETSIZE connection
> mpeppl :> Stephe :property, via ct_con_props, prior to opening the connection.
> mpeppl :> Stephe :
> mpeppl :> Stephe :--------------------------------------------------------------------------------
> mpeppl :> Stephe :Note
> mpeppl :> Stephe :You may have to reconfigure  SQL  Server  to  accept  a  larger  maximum
> mpeppl :> Stephe :network packet size. See the SQL Server System Administration Guide  for
> mpeppl :> Stephe :instructions on reconfiguring the maximum network packet size.
> mpeppl :> Stephe :
> mpeppl :> Stephe :
> mpeppl :> Stephe :On Fri, 30 Aug 2002 @ 3:34pm, an entity claiming to be Stephen.Sprague@morg...:
> mpeppl :> Stephe :
> mpeppl :> Stephe :Stephe :hi folks. I'm using Michael's BLK routines to do bulk inserts. Should  I
> mpeppl :> Stephe :Stephe :be able to use blk_init on a table with an image column?
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :Stephe :Currently I'm getting a Signal SEGV.
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :Stephe :Here's the versions:
> mpeppl :> Stephe :Stephe :   Perl          v5.6
> mpeppl :> Stephe :Stephe :   Sybase::CTlib v2.14
> mpeppl :> Stephe :Stephe :   OpenClient    v12.0
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :Stephe :I couldn't find any doc to the contrary and I see Sybase's command  line
> mpeppl :> Stephe :Stephe :bcp references switch -T [image size] so I think it's possible. The question
> mpeppl :> Stephe :Stephe :is does the Perl API support something analogous?
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :Stephe :Any pointers welcome.
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :Stephe :Thanks,
> mpeppl :> Stephe :Stephe :Steve
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :Stephe :
> mpeppl :> Stephe :
> mpeppl :> Stephe :
> mpeppl :>
> mpeppl :>
> mpeppl :
> 
> 
-- 
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!