Recent

Author Topic: Raspberry pi and sqlserver  (Read 9445 times)

superc

  • Full Member
  • ***
  • Posts: 241
Raspberry pi and sqlserver
« on: June 22, 2018, 04:57:45 pm »
Hello,
there are components can I use in Raspberry to connect to sqlserver?
Thanks in advance

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: Raspberry pi and sqlserver
« Reply #1 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.
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Raspberry pi and sqlserver
« Reply #2 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...
« Last Edit: June 22, 2018, 08:51:18 pm by Thaddy »
Specialize a type, not a var.

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: Raspberry pi and sqlserver
« Reply #3 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.
 
regards
Andreas

superc

  • Full Member
  • ***
  • Posts: 241
Re: Raspberry pi and sqlserver
« Reply #4 on: June 25, 2018, 08:19:31 am »
wow, now I will try and thank you very much  :D.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: Raspberry pi and sqlserver
« Reply #5 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');

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: Raspberry pi and sqlserver
« Reply #6 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 :-)
« Last Edit: June 25, 2018, 02:53:57 pm by af0815 »
regards
Andreas

superc

  • Full Member
  • ***
  • Posts: 241
Re: Raspberry pi and sqlserver
« Reply #7 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