![]() |
DB2 odbc unter Linux
Hat das jemand bereits zum Laufen gebracht? In der 64-bit Windows Variante funktioniert es, bei Linux kommt es zu Fehlern bei der Initialisierung:
Code:
Zugriff über die IBM CLI db2 funktioniert.
Im Projekt hello ist eine Exception der Klasse EODBCNativeException mit der Meldung '[FireDAC][Phys][ODBC][IBM][CLI Driver] CLI0133E Option type out of range. SQLSTATE=HY092' aufgetreten.
Delphi-Quellcode:
program hello;
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, Data.DB, FireDAC.Stan.Def, FireDAC.Phys.DB2, FireDac.Comp.Client, FireDAC.Stan.Consts, System.IOUtils; var Connection : TFDConnection; Link : TFDPhysDB2DriverLink; begin {$ifdef LINUX} Link := TFDPhysDB2DriverLink.Create(nil); Link.VendorHome := TPath.Combine(TPath.GetHomePath, 'sqllib/lib64'); Link.VendorLib := 'libdb2.so'; writeln(Link.VendorHome); {$endif} Connection := TFDConnection.Create(nil); try Connection.Params.DriverID := 'DB2'; Connection.Params.Values['Server'] := '<xx.xxx.xx.xx>'; Connection.Params.Values['Port'] := '50000'; Connection.Params.Values['Protocol'] := 'TCPIP'; Connection.Params.Values['Database'] := '<dbname>'; Connection.Params.Values['User_Name'] := '<user>'; Connection.Params.Values['Password'] := '<password>'; Connection.Connected := True; writeln('Connected'); Readln; except on E: Exception do writeln(E.ClassName, ': ', E.Message); end; Connection.Free; end. |
AW: DB2 odbc unter Linux
Konnte es jetzt lösen. Der db2 Treiber dar nicht direkt geladen werden sondern über odbcunix.
Dazu waren folgende minmale einträge notwendig: odbcinst.ini
Code:
odbc.ini
[DB2]
Description=DB2 Driver Driver=/home/<username>/sqllib/libdb2.so FileUsage=1 DontDLClose=1
Code:
[DB2]
Description=DB2 Test connection Driver=DB2
Delphi-Quellcode:
Link.VendorHome := '/usr/local/lib';
Connection.Params.Values['DSN'] := 'DB2'; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:22 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz