Special character issue connecting Mod lua to Sybase DB using Freetds

Upadhay, Krishna - Kolkata kupadhay at wiley.com
Fri Oct 21 09:29:22 CEST 2016


Hi,


We are trying to fetch data from sybase DB through mod lua (in apache 2.4.23) using the freetds(downloaded from

https://www.opencsw.org/package/freetds/).

OS details is: Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC

The lua module receives a key from the http request and looks up for the corresponding value from a sybase database table.
The problem is in this database lookup. It's only a plain select query fetching a single value of type varchar.

However, some random characters get appended to the retrieved value at the end when we recieve it in the lua module.

We tried to gather a pattern of data for which we encountered the issue. If the character count of the string value that is fetched from DB is exactly 2^n, the data fetched is absolutely fine. Anything greater or less than that is appended with random characters at the end. Following are few examples:

-- 9 character varchar value in DB -> 0021/2015
-- Data received in lua code -> 0021/2015h

-- 17 character varchar value in DB -> 0021/2015/06/18/7
-- Data received in lua code -> 0021/2015/06/18/7\x07\xc1\xd4

-- 33 character varchar value in DB -> 0021/2015/06/18/732/10.1002-2Fabc
-- Data received in lua code -> 0021/2015/06/18/732/10.1002-2Fabc\x02h

-- 65 character varchar value in DB -> 0021/2015/06/18/732/10.1002-2Fab0021/2015/06/18/732/10.1002-2Fabc
-- Data received in lua code -> 0021/2015/06/18/732/10.1002-2Fab0021/2015/06/18/732/10.1002-2FabcY\x140

Please note the following:
1. The issue do not happen in a RHEL system
2. The same functionality works fine if we lookup a similar table in MySQL.


Any comments regarding the cause of this issue would be really helpful.


Thanks & Regards,
Krishna Upadhyay
Tata Consultancy Services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencsw.org/pipermail/users/attachments/20161021/9bed718b/attachment.html>


More information about the users mailing list