FAQ
hi,

by odbc package, run sql exec, occurs SQLExecute: {HY090} errors

1) when insert column data' length less than 8000bytes, OK, Otherwise
occurs SQLExecute: {HY090} errors
2) the field type is image

any good idea to solve it?

thanks.






--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Tango at Mar 25, 2014 at 1:49 pm
    the odbc package is http://code.google.com/p/odbc
    On Tuesday, March 25, 2014 9:48:34 PM UTC+8, Tango wrote:

    hi,

    by odbc package, run sql exec, occurs SQLExecute: {HY090} errors

    1) when insert column data' length less than 8000bytes, OK, Otherwise
    occurs SQLExecute: {HY090} errors
    2) the field type is image

    any good idea to solve it?

    thanks.





    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Konstantin Khomoutov at Mar 25, 2014 at 2:09 pm

    On Tue, 25 Mar 2014 06:48:34 -0700 (PDT) Tango wrote:

    by odbc package, run sql exec, occurs SQLExecute: {HY090} errors

    1) when insert column data' length less than 8000bytes, OK,
    Otherwise occurs SQLExecute: {HY090} errors
    2) the field type is image

    any good idea to solve it?
    Mere googling for the exact ODBC error [1] turns up a whole bunch of
    errors all related to accessing various Microsoft DB products (by the
    way, for some unknown reason you did not tell us which one you're
    trying to access), and all of them refer to the "Invalid string or
    buffer length" error from the undelying driver or the like.

    Since 8k bytes is indeed a "magic constant" for Microsoft SQL Server,
    I'd say you get expected results for a column of type varchar(n).
    May be you should use varchar(max) instead?

    P.S.
    Next time you ask for assistance please provide way more details about
    your environment. Doing guesseneering is fun but not always productive.

    1. https://www.google.com/search?q="HY090"
    2. http://msdn.microsoft.com/en-us/library/ms176089

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Konstantin Khomoutov at Mar 25, 2014 at 2:14 pm

    On Tue, 25 Mar 2014 18:09:35 +0400 Konstantin Khomoutov wrote:
    by odbc package, run sql exec, occurs SQLExecute: {HY090} errors

    1) when insert column data' length less than 8000bytes, OK,
    Otherwise occurs SQLExecute: {HY090} errors
    2) the field type is image

    any good idea to solve it?
    Mere googling for the exact ODBC error [1] turns up a whole bunch of
    errors all related to accessing various Microsoft DB products (by the
    way, for some unknown reason you did not tell us which one you're
    trying to access), and all of them refer to the "Invalid string or
    buffer length" error from the undelying driver or the like.

    Since 8k bytes is indeed a "magic constant" for Microsoft SQL Server,
    I'd say you get expected results for a column of type varchar(n).
    May be you should use varchar(max) instead?
    Sorry, I missed that the field type is image, so if it's MS SQL
    Server you should be fine. Looks like a bug in the driver then.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Tango at Mar 25, 2014 at 2:27 pm
    The bug should be here:

    https://code.google.com/p/odbc/source/browse/param.go#117

                     ctype = api.SQL_C_BINARY
                     b := make([]byte, len(d))
                     copy(b, d)
                     p.Data = b
                     buf = unsafe.Pointer(&b[0])
                     buflen = api.SQLLEN(len(b))
                     plen = p.StoreStrLen_or_IndPtr(buflen)
                     size = api.SQLULEN(len(b))
                     sqltype = api.SQL_BINARY
    Binding Parameters for SQL Character Types [1]

    If the SQL data type passed in is a character type, ColumnSize is the size
    in characters (not bytes). If the length of the data string in bytes is
    greater than 8000,ColumnSize should be set to SQL_SS_LENGTH_UNLIMITED,
    indicating that there is no limit to the size of the SQL type.

    For instance, if the SQL data type is SQL_WVARCHAR, ColumnSize should not
    be greater than 4000. If the actual data length is greater than 4000, then
    ColumnSizeshould be set to SQL_SS_LENGTH_UNLIMITED so that nvarchar(max) will
    be used by driver.

    [1]: http://msdn.microsoft.com/en-us/library/ms131462.aspx
    On Tuesday, March 25, 2014 10:14:41 PM UTC+8, Konstantin Khomoutov wrote:

    On Tue, 25 Mar 2014 18:09:35 +0400
    Konstantin Khomoutov <flat...@users.sourceforge.net <javascript:>> wrote:
    by odbc package, run sql exec, occurs SQLExecute: {HY090} errors

    1) when insert column data' length less than 8000bytes, OK,
    Otherwise occurs SQLExecute: {HY090} errors
    2) the field type is image

    any good idea to solve it?
    Mere googling for the exact ODBC error [1] turns up a whole bunch of
    errors all related to accessing various Microsoft DB products (by the
    way, for some unknown reason you did not tell us which one you're
    trying to access), and all of them refer to the "Invalid string or
    buffer length" error from the undelying driver or the like.

    Since 8k bytes is indeed a "magic constant" for Microsoft SQL Server,
    I'd say you get expected results for a column of type varchar(n).
    May be you should use varchar(max) instead?
    Sorry, I missed that the field type is image, so if it's MS SQL
    Server you should be fine. Looks like a bug in the driver then.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Tango at Mar 25, 2014 at 2:38 pm
    change the code as the following:

    ctype = api.SQL_C_BINARY
    b := make([]byte, len(d))
    copy(b, d)
    p.Data = b
    buf = unsafe.Pointer(&b[0])
    buflen = api.SQLLEN(len(b))
    plen = p.StoreStrLen_or_IndPtr(buflen)
    if len(b) < 8000 {
    size = api.SQLULEN(len(b))
    sqltype = api.SQL_BINARY
    } else {
    size = api.SQLULEN(0) // SQL_SS_LENGTH_UNLIMITED
    sqltype = api.SQL_VARBINARY
    }

    all passed! :)
    On Tuesday, March 25, 2014 10:27:30 PM UTC+8, Tango wrote:

    The bug should be here:

    https://code.google.com/p/odbc/source/browse/param.go#117

    ctype = api.SQL_C_BINARY
    b := make([]byte, len(d))
    copy(b, d)
    p.Data = b
    buf = unsafe.Pointer(&b[0])
    buflen = api.SQLLEN(len(b))
    plen = p.StoreStrLen_or_IndPtr(buflen)
    size = api.SQLULEN(len(b))
    sqltype = api.SQL_BINARY
    Binding Parameters for SQL Character Types [1]

    If the SQL data type passed in is a character type, ColumnSize is the
    size in characters (not bytes). If the length of the data string in bytes
    is greater than 8000,ColumnSize should be set to SQL_SS_LENGTH_UNLIMITED,
    indicating that there is no limit to the size of the SQL type.

    For instance, if the SQL data type is SQL_WVARCHAR, ColumnSize should not
    be greater than 4000. If the actual data length is greater than 4000, then
    ColumnSizeshould be set to SQL_SS_LENGTH_UNLIMITED so that nvarchar(max) will
    be used by driver.

    [1]: http://msdn.microsoft.com/en-us/library/ms131462.aspx
    On Tuesday, March 25, 2014 10:14:41 PM UTC+8, Konstantin Khomoutov wrote:

    On Tue, 25 Mar 2014 18:09:35 +0400
    Konstantin Khomoutov wrote:
    by odbc package, run sql exec, occurs SQLExecute: {HY090} errors

    1) when insert column data' length less than 8000bytes, OK,
    Otherwise occurs SQLExecute: {HY090} errors
    2) the field type is image

    any good idea to solve it?
    Mere googling for the exact ODBC error [1] turns up a whole bunch of
    errors all related to accessing various Microsoft DB products (by the
    way, for some unknown reason you did not tell us which one you're
    trying to access), and all of them refer to the "Invalid string or
    buffer length" error from the undelying driver or the like.

    Since 8k bytes is indeed a "magic constant" for Microsoft SQL Server,
    I'd say you get expected results for a column of type varchar(n).
    May be you should use varchar(max) instead?
    Sorry, I missed that the field type is image, so if it's MS SQL
    Server you should be fine. Looks like a bug in the driver then.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 25, '14 at 1:49p
activeMar 25, '14 at 2:38p
posts6
users2
websitegolang.org

2 users in discussion

Tango: 4 posts Konstantin Khomoutov: 2 posts

People

Translate

site design / logo © 2022 Grokbase