Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Memory Allocation Error when to fetching BLOB field from MS-SQL server Table

Reply
Thread Tools

Memory Allocation Error when to fetching BLOB field from MS-SQL server Table

 
 
Bazil
Guest
Posts: n/a
 
      11-30-2003
If anyone has experience in fetching a Blob field on MS-SQL(7) please have a
look at this.

I am trying to fetch a Blob column (Image) from a MS-SQL(7) table.
The select terminates with and error:
"Could not allocate enough memory (-1 bytes) for column 1."
it dies on line 14.

Thanks for any suggestion.

Bazil

Here is the Code:

1 use Win32::ODBC;
2 if (!($dbh = new Win32::ODBC("DSN=CameraSQL;UID=***;PWD=***" )))
3 {
4 $Err ='ODBC';
5 $ErrMsg='ODBC:'. "new(): " . Win32::ODBC::Error();
6 print $ErrMsg <BR>;
7 die;
8 }
9 $SqlString = " Select viewcontent from NewProfile where ID='Prof2' ";
10 if(($dbh->Sql( $SqlString )))
11 {
12 $ErrMsg = 'SQL-Err:'.$dbh->Error();
13 print "SQL ERR on: $SqlString $ErrMs
14 die
15 };
16 $dbh->FetchRow();
17 {
18 undef %Data;
19 %Data = $dbh->DataHash();
10 $FldContent=$Data{$_[1]};


 
Reply With Quote
 
 
 
 
William Herrera
Guest
Posts: n/a
 
      11-30-2003
On Sat, 29 Nov 2003 20:33:04 -0500, "Bazil" <(E-Mail Removed)> wrote:

>If anyone has experience in fetching a Blob field on MS-SQL(7) please have a
>look at this.
>
>I am trying to fetch a Blob column (Image) from a MS-SQL(7) table.
>The select terminates with and error:
>"Could not allocate enough memory (-1 bytes) for column 1."
> it dies on line 14.
>
>Thanks for any suggestion.
>
>9 $SqlString = " Select viewcontent from NewProfile where ID='Prof2' ";
>10 if(($dbh->Sql( $SqlString )))
>11 {
>12 $ErrMsg = 'SQL-Err:'.$dbh->Error();
>13 print "SQL ERR on: $SqlString $ErrMs
>14 die
>15 };
>16 $dbh->FetchRow();
>17 {
>18 undef %Data;
>19 %Data = $dbh->DataHash();
>10 $FldContent=$Data{$_[1]};


Suggestion: can you fetch a small, non-blob data entry form the same database?
If you can, then see how big of a blob you can fetch without error--start with
a blob one byte in size.

Can you add a line to the database with the test data oulined above?

---
Use the domain skylightview (dot) com for the reply address instead.
 
Reply With Quote
 
 
 
 
Bazil
Guest
Posts: n/a
 
      11-30-2003
- There are no trouble fetching non blob fields, (Text ,numeric etc.)
-Inserted a 3 character text into Blob Field, OK
- Fetch a 3 Characte Blob text "ABC" failed as well

It looks like trying to allocate -1 byte to image field and it failes!!!

SQL ERR on: Select viewcontent from NewProfile where ID='AA' and
CUSTID='BEHZAD' SQL-Err:[911] [2] [0] "Could not allocate enough memory (-1
bytes) for column 1.
"


"William Herrera" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Sat, 29 Nov 2003 20:33:04 -0500, "Bazil" <(E-Mail Removed)> wrote:
>
> >If anyone has experience in fetching a Blob field on MS-SQL(7) please

have a
> >look at this.
> >
> >I am trying to fetch a Blob column (Image) from a MS-SQL(7) table.
> >The select terminates with and error:
> >"Could not allocate enough memory (-1 bytes) for column 1."
> > it dies on line 14.
> >
> >Thanks for any suggestion.
> >
> >9 $SqlString = " Select viewcontent from NewProfile where ID='Prof2'

";
> >10 if(($dbh->Sql( $SqlString )))
> >11 {
> >12 $ErrMsg = 'SQL-Err:'.$dbh->Error();
> >13 print "SQL ERR on: $SqlString $ErrMs
> >14 die
> >15 };
> >16 $dbh->FetchRow();
> >17 {
> >18 undef %Data;
> >19 %Data = $dbh->DataHash();
> >10 $FldContent=$Data{$_[1]};

>
> Suggestion: can you fetch a small, non-blob data entry form the same

database?
> If you can, then see how big of a blob you can fetch without error--start

with
> a blob one byte in size.
>
> Can you add a line to the database with the test data oulined above?
>
> ---
> Use the domain skylightview (dot) com for the reply address instead.



 
Reply With Quote
 
William Herrera
Guest
Posts: n/a
 
      11-30-2003
On Sun, 30 Nov 2003 11:24:15 -0500, "Bazil" <(E-Mail Removed)> wrote:

>- There are no trouble fetching non blob fields, (Text ,numeric etc.)
>-Inserted a 3 character text into Blob Field, OK
>- Fetch a 3 Characte Blob text "ABC" failed as well
>
>It looks like trying to allocate -1 byte to image field and it failes!!!
>


You need to look at the way the image fields are defined originally. Do you
have the SQL code that created the database anywhere? What happens if you fetch
a row of the table using DBI without selecting just the field in question?



---
Use the domain skylightview (dot) com for the reply address instead.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using IIS ASP to display a blob field in SQL Server 2005 None@none.com ASP General 4 09-02-2010 04:51 AM
static memory allocation versus dynamic memory allocation Ken C Programming 24 11-30-2006 12:37 AM
What is the difference between dynamic memory allocation,and stack allocation ? chris C++ 6 10-28-2005 05:27 AM
Could not allocate enough memory ( Fetch a Blob column from a MS-SQL(7) table. SQL) Steve Perl Misc 4 11-28-2003 06:00 PM
Fetching blob field get memory allocation error Steve Perl 0 11-27-2003 11:43 PM



Advertisments