Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: mpeppler at itf dot ch (Michael Peppler)
Subject: Re: Problem with loading multiple tables with sybperl bcp
Date: Feb 20 1996 7:21AM

> From: (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():
  &bcp_init($table, ...);
- (You're not going to like this one...) Close and reopen the dbproc after 
  each &bcp_done...