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

Discussion in 'Perl Misc' started by Bazil, Nov 30, 2003.

  1. Bazil

    Bazil Guest

    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]};
    Bazil, Nov 30, 2003
    #1
    1. Advertising

  2. On Sat, 29 Nov 2003 20:33:04 -0500, "Bazil" <> 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.
    William Herrera, Nov 30, 2003
    #2
    1. Advertising

  3. Bazil

    Bazil Guest

    - 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" <> wrote in message
    news:...
    > On Sat, 29 Nov 2003 20:33:04 -0500, "Bazil" <> 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.
    Bazil, Nov 30, 2003
    #3
  4. On Sun, 30 Nov 2003 11:24:15 -0500, "Bazil" <> 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.
    William Herrera, Nov 30, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    0
    Views:
    454
    Steve
    Nov 27, 2003
  2. Ken
    Replies:
    24
    Views:
    3,864
    Ben Bacarisse
    Nov 30, 2006
  3. Replies:
    4
    Views:
    1,452
    Bwig Zomberi
    Sep 2, 2010
  4. Steve
    Replies:
    4
    Views:
    363
    James Willmore
    Nov 28, 2003
  5. Replies:
    0
    Views:
    86
Loading...

Share This Page