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: kchomic at elmer dot tcinc dot com (Ken Chomic)
Subject: Re: Problem with loading multiple tables with sybperl bcp
Date: Feb 20 1996 4:19PM

> From owner-sybperl-l@trln.lib.unc.edu Tue Feb 20 00:29 MST 1996
> X-Listname: SybPerl Discussion List 
> Warnings-To: <>
> Date: Tue, 20 Feb 96 08:21:05 +0100
> From: mpeppler@itf.CH (Michael Peppler)
> To: SYBPERL-L@trln.lib.unc.edu
> Subject: Re: Problem with loading multiple tables with sybperl bcp
> 
> > From: soup@ampersand.com (Doug Campbell)
> > 
> > I've run into an odd behavior of Sybase and/or Sybperl.  I have a
> > program that loads 8 tables via BCP.  The basic flow is the following:
> > 
> > 	&dblogin();
> > 	foreach $table (@tables)
> > 	{
> > 	    &bcp_init ($dbproc, "$db..$table", "", "", DB_IN);
> > 	    &bcp_meminit ($dbproc, $num_fields);
> > 	    foreach $row (@rows)
> > 	    {
> > 		&bcp_sendrow ($dbproc, @row);
> > 	    };
> > 	    &bcp_done ($dbproc);
> > 	};
> > 
> > On the 8th (and last) table, when I call &bcp_done() Sybase prints:
> > 
> > 	Msg 925, Level 16, State 1
> > 	Line 1
> > 		Maximum number of used databases for each query has been exceeded. The maximum allowed is 8.
> > 
> > and the row does not get loaded.  The function &bcp_done() returns 1.
> > The program works fine for many other cases where I load fewer than 8
> > tables in this loop.
> 
> Strange indeed...
> 
> I would assume that the limit is in Sybase, not in sybperl (I've just
> gone back to check the bcp library docs, and there's no
> 'free_all_resources' call for bcp...)
> 
> Things to try:
> 
> - Change context to the target database before calling bcp_init():
>   &dbuse($db);
>   &bcp_init($table, ...);
> - (You're not going to like this one...) Close and reopen the dbproc after 
>   each &bcp_done...

The latter is the way I've found works.  And you're right about not liking it.
This appears to be a limitation we have to work around.

ken