[Solved] Linux mdbtools-odbc longint data lazarus / 16-Databases ---------------------------------------------------------------------- iru · 2016-04-28 11:29 Gentlefolk, Environment: Linux Mint 17.3, Laz 1.6, fpWeb installed. Underlying ODBC is "mdbtools" (the only ODBC mechanism system that I could install and run without obscure installation problems, a driver that worked, etc (I may be the problem here!)). I have a program which successfully access an Access/jet/.mdb database. It will read a table and display "character" columns correctly. "LongInt" integers do not display correctly! The statement  " SQLBindCol(stmtHandle,1,SQL_INTEGER,SQLPointer(@ResID),4,@ErrCode);" defines column1 in the table. The statement "Res:=SQLFetch(StmtHandle);" makes each entry in the table accessible. The contents of column 1 should be accessible in "ResID" Which is a "LongInt". I can inspect the contents of the .mdb file with the MDBTOOLS file viewer and display the table and correct values for column 1 (for example a row entry with column 1 = 752) . Using the Bless hex editor I can inspect the contents of the .mdb file and locate the appropriate row and  column 1. In hex it is F2:02:00:00 which is 752 in "little endian" format. Run the program and I get ResID = 842348288, SwapEndian(ResID) = ResDebug = 3618098 (may actually be from a row with col 1 = 751 or 753 (having problems with the row count.....)) Any help appreciated, Ian. ---------------------------------------------------------------------- marcov · 2016-04-28 11:44 Quote from: iru on April 28, 2016, 01:29:21 pm ResID = 842348288, This is hex $32353700  which is an ascii string #0'752' So it seems a string is interpreted as integer somewhere. ---------------------------------------------------------------------- iru · 2016-04-29 05:40 Marcov, Well done!!!! I did not see that at all. There is something funny down in the odbc-access API. Everything I can see indicates that the returned data should be a LongInt. Thanks, Ian. ---------------------------------------------------------------------- mig-31 · 2016-04-29 08:10 Why are you using mdb (Access file) database under Linux? It is better to use SQL Lite or Firebird or other. You can a access to SQL Lite/Firebird through ODBC driver or directly.