cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Program fails with weird error

oneeyeman1
Participant
0 Kudos
446

Hi, ALL,

I hope this is the proper place... 😉

I have a Windows 10 VM where I installed SQL Anywhere 17.0.

What I'm now trying to do is to connect to it with ODBC driver from my C++ program.

Connection is successful, however after that I try to execute following:

[code]

for( int i = 0; i < 5; i++ )
{
catalog[i].TargetType = SQL_C_WCHAR;
catalog[i].BufferLength = ( bufferSize + 1 );
catalog[i].TargetValuePtr = malloc( sizeof( unsigned char ) * catalog[i].BufferLength );
ret = SQLBindCol( m_hstmt, (SQLUSMALLINT) i + 1, catalog[i].TargetType, catalog[i].TargetValuePtr, catalog[i].BufferLength, &( catalog[i].StrLen_or_Ind ) );
if( ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, 1 );
result = 1;
break;
}
}

[/code]


Running this code fails with the error HY090 (Invalid string or buffer length).

According to MSDN, this error is returned when the BufferLength parameter is less than 0 or if the driver is 2,x and not 3.x version. Both cases are not true here.

Could someone please explain what is happenning? Did I hit some kind of bug in the driver?

The code is for preparation to run the SQLTables() function.

I can probably work-around it with a straight up query, but...

Thank you.

P.S. Forgot to say - using MSVC 2017.

Accepted Solutions (0)

Answers (0)