Re: Regarding Unix ODBC SQLFetch issue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Regarding Unix ODBC SQLFetch issue

Nick Gorham-2
On 10/05/16 14:31, D Pamuleti wrote:

Hi,

 

We are using Unix ODBC 2.3.4(64-bit) for connecting to the Oracle Instant Client 12.1.0.1(64-bit) in AIX machine.

 

We are facing the below issue while calling the SQLFetch or SQLFetchScroll function for fetching the data from database.

 

Query:

 

SQL = [select ss.description, c.capacity_code,c.use_flag from sys_string ss, capacity_type c where ss.entity = 'CAPACITY_TYPE' and ss.a...][length = 222 (SQL_NTS)]

 

Full Query :

 

select ss.description, c.capacity_code,c.use_flag from sys_string ss, capacity_type c where ss.entity = 'CAPACITY_TYPE' and ss.attribute = 'CAPACITY_CODE' and ss.key_value = c.capacity_code and ss.lang_id = 'EN' ;

 

If the returned columns count are greater than 2 then SQLFetch or SQLFetchScroll giving the following error “DIAG [01004] [Oracle][ODBC]String data, right truncated.”

 

For Testing purpose I modified the above query to return only 2 columns and SQLFetch or SQLFetchScroll gave the results correctly without any errors.

 

Modified Query :

 

select ss.description, c.capacity_code from sys_string ss, capacity_type c where ss.entity = 'CAPACITY_TYPE' and ss.attribute = 'CAPACITY_CODE' and ss.key_value = c.capacity_code and ss.lang_id = 'EN' ;

 

Could you please let me know is there any limit on fetching the columns count or am I missing any settings for that.

 

I am attaching the ODBC trace logs for Error and Successful run of the above query. Could you please check and update your suggestions or any settings required for that.

 

Thanks,

DASARI


Hi,

I am just about certain that this is a issue with the Oracle driver. I would check what size buffer your application is binding to the columns. Driver manager tracing may help you here.

--
Nick

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Regarding Unix ODBC SQLFetch issue

Nick Gorham-2
On 10/05/16 14:39, D Pamuleti wrote:

Do I need to add any settings for getting the Drive Manager tracing logs?


odbc.ini

[ODBC]
Trace=Yes
TraceFile=/tmp/sql.log

--
Nick

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Regarding Unix ODBC SQLFetch issue

Nick Gorham-2
On 10/05/16 14:43, D Pamuleti wrote:

Hi Nick,

 

I have added those settings and got the Trace logs. I have attached the trace logs for Error and Successful run of the query.

 

Could you please check and let me know if I miss anything there.

 

Thanks,

DASARI


Not that I am here to debug your application code, but the log shows that the driver is reporting a column size of 30 characters

[ODBC][14156158][1462886822.146143][SQLDescribeCol.c][247]
        Entry:
            Statement = 11033f670
            Column Number = 1
            Column Name = fffffffffffe068
            Buffer Length = 128
            Name Length = fffffffffffddb8
            Data Type = fffffffffffddb6
            Column Size = fffffffffffddc0
            Decimal Digits = fffffffffffddb4
            Nullable = fffffffffffddb2
[ODBC][14156158][1462886822.147447][SQLDescribeCol.c][504]
        Exit:[SQL_SUCCESS]                
            Column Name = [USER]                
            Data Type = fffffffffffddb6 -> 12                
            Column Size = fffffffffffddc0 -> 30                
            Decimal Digits = fffffffffffddb4 -> 0                
            Nullable = fffffffffffddb2 -> 1

Your application thens bind it to return a SQL_WCHAR (two byte per character) and gives a buffer length in bytes of 31.

[ODBC][14156158][1462886822.148699][SQLBindCol.c][236]
        Entry:
            Statement = 11033f670
            Column Number = 1
            Target Type = -8 SQL_WCHAR
            Target Value = 110376a10
            Buffer Length = 31
            StrLen Or Ind = 110363b70
[ODBC][14156158][1462886822.149756][SQLBindCol.c][344]
        Exit:[SQL_SUCCESS]

--
Nick

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Regarding Unix ODBC SQLFetch issue

Nick Gorham-2
On 10/05/16 15:01, D Pamuleti wrote:

Hi Nick,

 

I have changed the code and it points to buffer length of 30 but still getting the same error. I have attached the trace log for the same.

 

Thanks,

DASARI


Again, "Not that I am here to debug your application code", 30 SQL_WCHAR, characters will occupy 60 bytes of storage, add a extra 2 bytes for the 0x0000 at the end, then you need to allocate are tell the drover that the buffer size if 62 bytes.

--
Nick


_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support