Can not find unit mssqlconn - solved lazarus / 16-Databases ---------------------------------------------------------------------- bambamns · 2013-12-15 04:25 Hi, Is this a bug or it can be fixed easily ? When I add to existing Windows project TSybaseConnection everithing is ok, but if I add TSybaseConnection to WinCE project , Lazarus is making compile error : Can not find unit mssqlconn When I look for the path, file exist :  d:\lazarus\fpc\2.6.2\source\packages\fcl- db\src\sqldb\mssql\mssqlconn.pp I use Lazarus 1.2RC1 (FPC 2.6.2). Thx ---------------------------------------------------------------------- BigChimp · 2013-12-15 04:33 mssqlconn is probably not enabled for WinCE. Remember you need a FreeTDS dll for mssqlconn to work. Do you have one for WinCE? Does it work? ---------------------------------------------------------------------- bambamns · 2013-12-15 05:03 Thx, Actually I need to connect to Sybase DB (over SQL Anyware) and I tried to do it with TSybaseConnection. Now I see it use ODBC, but I still have a problem. When I start WinCE application it requires odbc32.dll. I have driver parametar in code, but it still need odbc32.dll Code: [Select]Driver := 'windows\dbodbc11.dll'; ---------------------------------------------------------------------- BigChimp · 2013-12-15 05:56 FYI: Sybase ASE is suported by mssqlconn; Sybase ASA is not. Regarding ODBC: make sure you use the right properties: http://wiki.lazarus.freepascal.org/ODBCConn#TODBCConnection_properties No idea what the driver property is... haven't used it actually have used it but forgot about it..., so can't tell if you're doing this right. ---------------------------------------------------------------------- bambamns · 2013-12-15 06:10 Well, as I can see in odbcsql.inc : Code: [Select]{$IFDEF Windows}   {$DEFINE extdecl:=stdcall}   const     odbclib = 'odbc32.dll'; {$ENDIF} later is : Code: [Select]Procedure InitialiseODBC(OverrideName : string =''); var libname : string; begin   inc(RefCount);   if RefCount = 1 then     begin     if OverrideName='' then        libname:=odbclib      else        libname:=OverrideName;     ODBCLibraryHandle := loadlibrary(libname);     if ODBCLibraryHandle = nilhandle then       begin       RefCount := 0;       Raise EInOutError.Create('Can not load ODBC client. Is it installed? ('+odbclib+')');       end; This message I get when I start WinCE application. FPC units for arm are compiled with this code and I can not change them. ---------------------------------------------------------------------- BigChimp · 2013-12-15 11:53 I'd look into a way to set overridename. If it doesn't exist, check if current trunk has a way (there have been a lot of fixes) and you could supply a patch. On trunk you could probably use: http://wiki.lazarus.freepascal.org/SQLDBLibraryLoader Edit: Note: strange that your ODBC manager has a different name - I strongly suspect that dbodbc11.dll is actually the Sybase ODBC driver implementation. If so, you'll still need odbc32.dll and need to register the Sybase driver with ODBC (don't know how that goes on embedded) so the ODBC subsystem knows about it. Then the driver will be loaded automatically by the CE ODBC subsystem.... as long as you specify the correct parameters in the connection string/set the proper ODBC connection properties. In other words: have you properly installed the Sybase driver or just copied a dll? ---------------------------------------------------------------------- bambamns · 2013-12-15 14:53 Yes, SQL Anyware is installed ok - on same device is Sybase PocketBuilder application and it works with it. I've made connection with ODBC successful - I copied dbodbc11.dll into odbc32.dll and it now runs SQL Anywhare. It can be done with SQLDBLibrayLoader and SQLConnector but it point's to odbc32.dll, too. Anyway , I can connect, but when I run simple select * from table I get error : [Sybase][ODBC Driver]Invalid string or buffer length It shows field names, but no fields contents. It is look like some ODBC communication problem : http://technet.microsoft.com/en-us/library/ms131690.aspx Any clue ? ---------------------------------------------------------------------- bambamns · 2013-12-15 20:16 Solution at last. Select statement has to convert or cast integer values - something like : Code: [Select]seect cast(sf_one as int) from table ---------------------------------------------------------------------- BigChimp · 2013-12-16 06:41 Aweseome, bambamns - thanks for posting & glad you got a solution. I was speculating about problems with the *W API calls for ODBC on CE... but didn't want to post as I really know nothing about the actual implementation..