<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Program fails with weird error in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619152#M4733201</link>
    <description>&lt;P&gt;I have not had any issues with this in the version you cited.  &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is the buffer size the same as in the SQLTables example? &lt;/LI&gt;&lt;LI&gt;What C++ tooling are you using i.e., Visual Studio?&lt;/LI&gt;&lt;LI&gt;Are you targeting 64 bit?&lt;/LI&gt;&lt;LI&gt;Are you developing for Wide i.e., SQLConnectW vs SQLConnectA (you may be calling SQLConnect and allowing the compile options handle this so check your project configuration)&lt;/LI&gt;&lt;LI&gt;And to confirm, is the SQLBindCol that reports this error correct? Does it occur on the first iteration?&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Fri, 07 Oct 2022 15:53:53 GMT</pubDate>
    <dc:creator>chris_keating</dc:creator>
    <dc:date>2022-10-07T15:53:53Z</dc:date>
    <item>
      <title>Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaq-p/12619149</link>
      <description>&lt;P&gt;Hi, ALL,&lt;/P&gt;
  &lt;P&gt;I hope this is the proper place... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt;I have a Windows 10 VM where I installed SQL Anywhere 17.0.&lt;/P&gt;
  &lt;P&gt;What I'm now trying to do is to connect to it with ODBC driver from my C++ program.&lt;/P&gt;
  &lt;P&gt;Connection is successful, however after that I try to execute following:&lt;/P&gt;
  &lt;P&gt;[code]&lt;/P&gt;
  &lt;P&gt; for( int i = 0; i &amp;lt; 5; i++ )&lt;BR /&gt; {&lt;BR /&gt; catalog[i].TargetType = SQL_C_WCHAR;&lt;BR /&gt; catalog[i].BufferLength = ( bufferSize + 1 );&lt;BR /&gt; catalog[i].TargetValuePtr = malloc( sizeof( unsigned char ) * catalog[i].BufferLength );&lt;BR /&gt; ret = SQLBindCol( m_hstmt, (SQLUSMALLINT) i + 1, catalog[i].TargetType, catalog[i].TargetValuePtr, catalog[i].BufferLength, &amp;amp;( catalog[i].StrLen_or_Ind ) );&lt;BR /&gt; if( ret != SQL_SUCCESS &amp;amp;&amp;amp; ret != SQL_SUCCESS_WITH_INFO )&lt;BR /&gt; {&lt;BR /&gt; GetErrorMessage( errorMsg, 1 );&lt;BR /&gt; result = 1;&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;
  &lt;P&gt;[/code]&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Running this code fails with the error HY090 (Invalid string or buffer length).&lt;/P&gt;
  &lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;Could someone please explain what is happenning? Did I hit some kind of bug in the driver?&lt;/P&gt;
  &lt;P&gt;The code is for preparation to run the SQLTables() function.&lt;/P&gt;
  &lt;P&gt;I can probably work-around it with a straight up query, but...&lt;/P&gt;
  &lt;P&gt;Thank you.&lt;/P&gt;
  &lt;P&gt;P.S. Forgot to say - using MSVC 2017.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 14:06:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaq-p/12619149</guid>
      <dc:creator>oneeyeman1</dc:creator>
      <dc:date>2022-10-05T14:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619150#M4733199</link>
      <description>&lt;P&gt;This is the proper place. Although, the &lt;A href="https://sqlanywhere-forum.sap.com/questions/38007/utf-8-characters-stored-ok-but-output-via-xml-procedure-fails"&gt;SQL Anywhere Forum&lt;/A&gt; is a more active user community for SQL Anywhere in case you do not get an answer here. &lt;/P&gt;&lt;P&gt;Can you confirm the version and build you are using? I tried this with the latest SQL Anywhere 17 software and cannot reproduce this issue. My test is based on the &lt;A href="https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqltables-function?view=sql-server-ver16"&gt;SQLTables Function&lt;/A&gt; documentation Example.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 20:00:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619150#M4733199</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2022-10-05T20:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619151#M4733200</link>
      <description>&lt;SPAN class="mention-scrubbed"&gt;chris.keating&lt;/SPAN&gt;&lt;P&gt;Thx for the reply.&lt;/P&gt;&lt;P&gt;Running "SELECT  @@version;" in the ISQL yields&lt;/P&gt;&lt;P&gt;17.0.10.6089.&lt;/P&gt;&lt;P&gt;Let me know f that is not enough.&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;And yes - I'm basing it on the same code as you.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 23:31:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619151#M4733200</guid>
      <dc:creator>oneeyeman1</dc:creator>
      <dc:date>2022-10-05T23:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619152#M4733201</link>
      <description>&lt;P&gt;I have not had any issues with this in the version you cited.  &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is the buffer size the same as in the SQLTables example? &lt;/LI&gt;&lt;LI&gt;What C++ tooling are you using i.e., Visual Studio?&lt;/LI&gt;&lt;LI&gt;Are you targeting 64 bit?&lt;/LI&gt;&lt;LI&gt;Are you developing for Wide i.e., SQLConnectW vs SQLConnectA (you may be calling SQLConnect and allowing the compile options handle this so check your project configuration)&lt;/LI&gt;&lt;LI&gt;And to confirm, is the SQLBindCol that reports this error correct? Does it occur on the first iteration?&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 07 Oct 2022 15:53:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619152#M4733201</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2022-10-07T15:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619153#M4733202</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;chris.keating&lt;/SPAN&gt; ,&lt;/P&gt;&lt;P&gt;See answers below:&lt;/P&gt;&lt;P&gt;1.Yes it is the same. And I didn't have any issues with any other DBMSes.&lt;/P&gt;&lt;P&gt;2.MSVC 2017 Free Edition.&lt;/P&gt;&lt;P&gt;3.Building the app as 32 bit for now.&lt;/P&gt;&lt;P&gt;4.I did define UNICODE in my solution.&lt;/P&gt;&lt;P&gt;5.It occur on the first iteration. And yes - it is correct. No issues with SQL Server.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 20:52:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619153#M4733202</guid>
      <dc:creator>oneeyeman1</dc:creator>
      <dc:date>2022-10-07T20:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619154#M4733203</link>
      <description>&lt;P&gt;I am not able to reproduce this using the SQLTables code sample. If you have support, you may want to consider pursuing a support incident. If not, an ODBC trace might provide insight into the problem source.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 12:17:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619154#M4733203</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2022-10-11T12:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Program fails with weird error</title>
      <link>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619155#M4733204</link>
      <description>&lt;P&gt;Are you able to share your project (or a pared down one) that shows this issue? Perhaps I could reproduce this issue using it.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 19:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/program-fails-with-weird-error/qaa-p/12619155#M4733204</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2022-10-12T19:21:29Z</dc:date>
    </item>
  </channel>
</rss>

