Easysoft ODBC-ODBC Bridge

Why do I get "[unixODBC][Easysoft ODBC (Server)]Memory allocation error"?

Article:
00712
Last Reviewed:
28th October 2008
Revision:
2

There is more than one way of getting this error but the most common reason is the application calling SQLBindCol with a very large BufferLength argument. This often arises from the following sequence of events:

SQLPrepare(select bigcol from table)
SQLExecute
SQLDescribeCol(1) - returns bigcol is a big number (e.g. 1073741824) in size
SQLBindCol(1, BufferLength=number_returned_from_SQLDescribeCol)

The OOB Client and OOB Server are running on different machines. If the application calls SQLBindCol with a very large buffer size it is saying I have this much memory available for the column data (even if it doesn't). The OOB Server needs to allocate this same buffer size to hold the data returned from the ODBC driver and in the case of very large buffers that is sometimes not possible. In most cases the application did not intend to do this or does not have that much buffer space available. There is one specific example of this with Perl's DBD::ODBC driver and SQL_WLONGVARCHAR columns:

Support for SQL_WLONGVARCHAR is available in DBD::ODBC only if the ODBC header files it is built with include sqlucode.h. In some versions of DBD::ODBC sqlucode.h is not included and so when an SQL_WLONGVARCHAR column is seen (ntext in SQL Server) DBD::ODBC does not pay attention to LongReadLen and uses the value from SQLDescribeCol.

When building DBD::ODBC 0.45 or earlier with OOB or unixODBC the Makefile.PL needs to be altered to include sqlucode.h output to dbdodbc.h. To do this:

[1] decide if you are building DBD::ODBC against the unixODBC driver manager or OOB directly. This affects which section of Makefile.PL you need to alter.

[2a] If building DBD::ODBC against OOB directly then look for the section of the Makefile.PL starting with

"elsif ($myodbc eq 'esodbc') {"

move down the blocks of lines from there until you see print commands writing #include lines to SQLH. At the end of the 3 print commands (but before the end of the block '}') add:

print SQLH qq{#include <sqlucode.h>\n};

[2b] If building DBD::ODBC against the unixODBC driver manager then look for the section of the Makefile.PL starting with

"elsif ($myodbc eq 'unixodbc') {"

Now follow the same instructions under [2a].

[3] After setting up all the environment variables DBD::ODBC needs run the "perl Makefile.PL" and you should now have a file called dbdodbc.h which contains a line like this:

#include <sqlucode.h>

[4] Continue building, testing and installing DBD::ODBC as usual.

Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)


Oracle is a registered trademark of Oracle Corporation and/or its affiliates.