Lazarus

Free Pascal => Database => Topic started by: superc on June 22, 2018, 04:57:45 pm

Title: Raspberry pi and sqlserver
Post by: superc on June 22, 2018, 04:57:45 pm
Hello,
there are components can I use in Raspberry to connect to sqlserver?
Thanks in advance
Title: Re: Raspberry pi and sqlserver
Post by: af0815 on June 22, 2018, 07:56:03 pm
No problem here to connect with zeos and maybe with sqldb. The correct driver are more the problem.
Title: Re: Raspberry pi and sqlserver
Post by: Thaddy on June 22, 2018, 08:48:02 pm
If you are using raspbian jessie sqldb works out of the box provided sqlserver is installed correctly and you have a client driver installed..
It only works with ODBC, though...
Title: Re: Raspberry pi and sqlserver
Post by: af0815 on June 23, 2018, 09:34:39 am
with $sudo apt-get install freetds-bin libsybdb5 there are the correct freetds drives on Raspi for MS-SQL installed in
  /usr/lib/arm-linux-gnueabihf/libsybdb.so.5   (=link)
  /usr/lib/arm-linux-gnueabihf/libsybdb.so.5.0.0
with ZEOS you can access now

Code: Pascal  [Select][+][-]
  1.        // SQLCon is a TZConnection from ZEOS
  2.        DebugLn('Using Linux Connection');
  3.        SQLCon.Protocol := 'FreeTDS_MsSQL>=2005';
  4.        {$ifdef RasPi}
  5.        SQLCon.LibraryLocation:= '/usr/lib/arm-linux-gnueabihf/libsybdb.so.5';
  6.        {$else}
  7.        SQLCon.LibraryLocation:= '/usr/lib/x86_64-linux-gnu/libsybdb.so.5.0.0';
  8.        {$endif}
  9.        SQLCon.HostName:= 'MSSQLServer';
  10.        SQLCon.User:= 'jondoe';
  11.        SQLCon.Password := 'secret';
  12.        SQLCon.Database:= 'mytestdb';
  13.        SQLCon.Properties.Add('appname=MyWorkingApp');
  14.  

This code is working for me on Debian (PC) and Rasbian (RasPi3). Also on windows PC with the correct driver-dll.

Actual i have not found to change the drivers-nane and position in SQL-DB.
 
Title: Re: Raspberry pi and sqlserver
Post by: superc on June 25, 2018, 08:19:31 am
wow, now I will try and thank you very much  :D.
Title: Re: Raspberry pi and sqlserver
Post by: marcov on June 25, 2018, 08:39:58 am
Actual i have not found to change the drivers-nane and position in SQL-DB.

Put dblib as first unit in your .lpr and then call dblib.initialisedblib('/position/to/libsybdb.so');
Title: Re: Raspberry pi and sqlserver
Post by: af0815 on June 25, 2018, 02:50:54 pm
Put dblib as first unit in your .lpr and then call dblib.initialisedblib('/position/to/libsybdb.so');
THX, Info added to the mssqlconn/dblib wiki :-)
Title: Re: Raspberry pi and sqlserver
Post by: superc on June 25, 2018, 05:27:42 pm
I know Zeos from version alpha.... I've tryed and works very well.... My day is better now, thanks a lot
TinyPortal © 2005-2018