Board index » delphi » Client Access/400 ODBC and Long VARCHAR fields with Delphi and BDE 3.5

Client Access/400 ODBC and Long VARCHAR fields with Delphi and BDE 3.5

We're using Borland Delphi 2.01, with the Borland Database
Engine 3.5, Client Access ODBC Driver (32-bit) V3R1M2 (the
new one) to connect to our AS/400 (V3R6) (current{*word*20}PTFs).

The problem is that when we try to update long character
fields on the AS/400, we get the message "Capability not
Supported" from the ODBC driver.

The error (according to the trace) follows an
SQLBindParameter statement with a fcType of 1 (SQL_C_CHAR) and
an fSqlType of -1 (SQL_LONGVARCHAR). This seems right
and the ODBC driver returns SQL_LONGVARCHAR when you ask it
the types it supports (SQLGetTypeInfo).

The error description says that either the conversion was not
supported (and I don't see how C_CHAR to LONGVARCHAR would be
a problem) or that the fSqlType was not supported, but I know
it is because of SQLGetTypeInfo.

We've tried various datatypes on the 400 including
VARCHAR(6000), LONG VARCHAR (with and without FOR BIT DATA),
and LONG VARBINARY.

I just need SOME long datatype (around 6000 bytes) that will
work.

An e-mail copy of any replies would be very kind. Thank you
very much.

--

Kevin Davidson, Q. S., Incorporated
ke...@qsinc.com

 

Re:Client Access/400 ODBC and Long VARCHAR fields with Delphi and BDE 3.5


Quote
Kevin Davidson wrote:

> We're using Borland Delphi 2.01, with the Borland Database
> Engine 3.5, Client Access ODBC Driver (32-bit) V3R1M2 (the
> new one) to connect to our AS/400 (V3R6) (current{*word*20}PTFs).

> The problem is that when we try to update long character
> fields on the AS/400, we get the message "Capability not
> Supported" from the ODBC driver.

> The error (according to the trace) follows an
> SQLBindParameter statement with a fcType of 1 (SQL_C_CHAR) and
> an fSqlType of -1 (SQL_LONGVARCHAR). This seems right
> and the ODBC driver returns SQL_LONGVARCHAR when you ask it
> the types it supports (SQLGetTypeInfo).

> The error description says that either the conversion was not
> supported (and I don't see how C_CHAR to LONGVARCHAR would be
> a problem) or that the fSqlType was not supported, but I know
> it is because of SQLGetTypeInfo.

> We've tried various datatypes on the 400 including
> VARCHAR(6000), LONG VARCHAR (with and without FOR BIT DATA),
> and LONG VARBINARY.

> I just need SOME long datatype (around 6000 bytes) that will
> work.

> An e-mail copy of any replies would be very kind. Thank you
> very much.

> --

> Kevin Davidson, Q. S., Incorporated
> ke...@qsinc.com

It seems there may be a problem with BDE 3.5.
I have the same problem with Oracle + ODBC and Interbase + SQL Links.
The query parameters of an update query accept long strings,
but when the actual length is > 255 characters I get the
"Capability not supported" message. I looked through the
Delphi VCL source code and could not find anything there
that could explain the problem. I can successfully read back
a long string passed to the query parameter, which means that
the error must occur later, when the parameter value is passed on.
Therefore I assume that there is a problem with the BDE, but
I may be wrong, of course. Anyways, the ODBC driver does
not seem the culprit (at least in this case - don't get
me going on Oracle's ODBC drivers, for instance).

If you find anything, like a workaround, please post or e-mail.

Regards,

Karl Waclawek

Re:Client Access/400 ODBC and Long VARCHAR fields with Delphi and BDE 3.5


Quote
Karl Waclawek wrote:
> It seems there may be a problem with BDE 3.5.
> I have the same problem with Oracle + ODBC and Interbase + SQL Links.
> The query parameters of an update query accept long strings,
> but when the actual length is > 255 characters I get the
> "Capability not supported" message. I looked through the
> Delphi VCL source code and could not find anything there
> that could explain the problem. I can successfully read back
> a long string passed to the query parameter, which means that
> the error must occur later, when the parameter value is passed on.
> Therefore I assume that there is a problem with the BDE, but
> I may be wrong, of course. Anyways, the ODBC driver does
> not seem the culprit (at least in this case - don't get
> me going on Oracle's ODBC drivers, for instance).

An addition to my reply:

I traced parameter passing down to the TQuery.SetParams method.
All string parameters are mapped to the 'fldZString' logical
BDE data type (when calling the BDE function 'DbiQSetParams').
This logical data type is in turn mapped by the BDE to
target data types corresponding to the CHAR() data type
(or SQL_C_CAHR for ODBC). Since this data type is usually
limited to a size of 255, one would expect an error message
when strings longer than 255 characters are passed, which is
indeed what happens in my case.

The problem does not exist, however, when updating is done through
queries with RequestLive = True and Cahed Updates = False.
(There is no explicit parameter passing through SetParams involved).

Maybe that is an explanation.
Anyone else with some ideas?

Regards,

Karl Waclawek

Other Threads