big int converted to float

Hello: 
   I noticed that big int in MSSQL is convert to float by odbc.k, 

shall we fix it so it convert to long? 

I’m  using 32 bit free version of kdb, and ODBC to connect to a MSSQL server, running on 64-bit ubuntu.

Regards.

in http://kx.com/q/c/c/odbc.c
it looks to me like SQL_BIGINT (-5) is converted to kdb+64bit int.

Can you give some more details?

The source code is available if you want to recompile/tweak it.

I have a table1 whose ID column is big int in sql 2012.

Here is the q code.

system “l odbc.k”

handle : .odbc.open “…”

ex : .odbc.eval[handle]

m : ex “select top 10 * from table1”
exec ID from m

0 11828 11829 11830 11831 11832 11833 11834 11835 11836f

As you can see, it returns f. 

It turns out to be Free TDS issue.
http://lists.ibiblio.org/pipermail/freetds/2010q3/026093.html

Thanks

I finally managed to make freetds run’s under TDS protocol version 7.1
I noticed:

   /etc/odbc.ini  required 

   /usr/local/etc/odbc.ini  required, ( don’t know why )

   /etc/odbcinst.ini  NOT required

  /usr/local/etc/odbcinst.ini required.

freetds.conf not required.

cat /usr/local/etc/odbcinst.ini 

[FreeTDS]

Description=v0.91 with protocol v7.1

Driver=/usr/lib/i386-linux-gnu/odbc/libtdsodbc.so

UsageCount=2


cat /usr/local/etc/odbc.ini 

[foo]

Driver      = FreeTDS 


 cat /etc/odbc.ini 

[foo]

Driver      = FreeTDS 

Database    = foo

Server      = 10.10.10.10

Port        = 1433


and I use the following connect string:

.odbc.open “dsn=foo;uid=yourid;pwd=yourpwd;TDS_Version=7.1”

To know what TDS version is really use:

export TDSDUMP=/tmp/freetds.log

run your q file to open odbc connection 

cat freetds.log | grep ‘TDS version’

net.c:205:Connecting to 10.10.10.10 port 1433 (TDS version 7.1)

Hope this will save your time.

Regards.

thanks! To figure out where the config files should be, you can use  odbcinst -j

$ odbcinst -j
unixODBC 2.3.1
DRIVERS…: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/auser/.odbc.ini
SQLULEN Size…: 4
SQLLEN Size…: 4
SQLSETPOSIROW Size.: 2

not for my case. 
Even it tells I should put /usr/local/etc/odbc.ini, it still reads from /etc/odbc.ini

$ odbcinst -j

unixODBC 2.3.2

DRIVERS…: /usr/local/etc/odbcinst.ini

SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini

FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources

Maybe your freetds driver and unixodbc were built with different config prefixes.
I’ve read you can override the runtime values by setting these env vars

$export ODBCINI=/my/path/odbc.ini
$export ODBCSYSINI=/my/path