MSSQL-Server mit Kylix

 

1. Module.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Es wurde nur Freeware bzw. OpenSource Software benutzt. Die benötige Module können aus folgenden Quellen herunterladen werden:

 

dbExpress Driver für ODBC

OpenSource

http://open-dbexpress.sourceforge.net

unixODBC

Freeware

http://www.unicodbc.org

FreeTDS

Freeware

http://www.freetds.org

 


2. Installation.

2.1. unixODBC.

 

gzip –d unixODBC-2.2.11.tgz

tar xvf unixODBC-2.2.11.tar

cd unixODBC-2.2.11/

./configure --enable-gui=no

make

make install

 

Default-Verzeichnis für die Bibliotheken ist /usr/local/lib. Konfigurationsdateien liegen in /usr/local/etc und sind odbc.ini und odbcinst.ini.

 

2.2. FreeTDS.

 

gzip –d freetds-stable.tgz

tar xvf freetds-stable.tar

cd freetds-0.63/

./configure --enable-msdblib --sysconfdir=/usr/local/etc --prefix=/usr/local/freetds --with-tdsver=8.0 --with-unixodbc

make

make install

 

Installationsverzeichnis ist /usr/local/freetds. Konfigurationsdatei ist /usr/local/etc/freetds.conf.

 

2.3. dbExpress Driver für unixODBC.

 

Heruntergeladenes Archiv dbxoodbc.zip in beliebiges Verzeichnis auspacken. Mit Kylix Projekt-Datei dbxoodbc.dpr kompilieren. Datei libdbxoodbc.so ins Verzeichnis /usr/lib kopieren.

 

Wichtig: Treiber muss ab Version 3.024 sein.


3. Konfiguration.

 

Hier sind Beispiele der Konfigurationsdateien:

/usr/local/etc/freetds.conf

[MsServer2000]

host = 192.168.5.214

port = 1433

tds version = 8.0

try server login = yes

try domain login = no

client charset = CP1252

/usr/local/etc/odbcinst.ini

[TDS]

Description  = FreeTDS

Driver       = /usr/local/lib/libtdsodbc.so

Setup        = /usr/local/lib/libtds.so

FileUsage    = 1

/usr/local/etc/odbc.ini

[MsServer2000]

Description=TDS

Driver=TDS

Servername=MsServer2000

Port=1433

 

Achtung :   Der Wert Servername in odbc.ini muss Sektionsname aus freetds.conf sein.

/etc/dbxlogbyts.conf

[LOGBYTS]

DriverName=OpenODBC

Database=DSN=MsServer2000;SERVER=192.168.5.214;PORT=1433;UID=rgag;PWD=aBlobSize=-1

LocaleCode=0000

GetDriverFunc=getSQLDriverODBC

LibraryName=libdbxoodbc.so

VendorLib=libodbc.so

 

Achtung :   Der Wert DNS in logbyts.conf muss Sektionsname aus odbc.ini sein.

 


Initialisierung TSQLConnection in Kylix-Programm

 

procedure InitConnection(aConn: TSQLConnection);

begin

  if not aConn.Connected then

  with aConn do

    begin

      //  Connection wird initialisiert

      Connected := false;

      LoginPrompt := false;

      LoadParamsOnConnect := false;

{$IFDEF LINUX}

      DriverName := 'OpenODBC';

      ConnectionName := 'LOGBYTS';

      LoadParamsFromIniFile('/etc/dbxlogbyts.conf');

      GetDriverFunc := trim(Params.Values['GetDriverFunc']);

      LibraryName := trim(Params.Values['LibraryName']);

      VendorLib := trim(Params.Values['VendorLib']);

{$ELSE}

      raise Exception.Create('Only Linux-Project');

{$ENDIF}

    end;

end;

 

4. dbExpress Einstellungen.

<user-home>/.borland/dbxdrivers

[Installed Drivers]

OpenODBC=1

 

….

 

[OpenODBC]

GetDriverFunc=getSQLDriverODBC

LibraryName=libdbxoodbc.so

VendorLib=libodbc.so

<user-home>/.borland/dbxconnections

[MSOpenODBC]

DriverName=OpenODBC

Database=DSN=MsServer2000;SERVER=192.168.5.214;PORT=1433;UID=rgag;PWD=aBlobSize=-1

LocaleCode=0000


5. Umgebungsvariable

 

Nach Software-Installation müssen folgende Umgebungsvariable initialisiert werden:

 

ODBCINI=/usr/local/etc/odbc.ini

 

FREETDS=/usr/local/etc/freetds.conf

 

SYBASE=/usr/local/freetds

 

TDSDUMP=/tmp/freetds.log

 

 

6. Beispiel der Apache-Konfigurationsdatei.

 

SetEnv LD_LIBRARY_PATH /usr/local/kylix3/bin

SetEnv ODBCINI=/usr/local/etc/odbc.ini

SetEnv FREETDS=/usr/local/etc/freetds.conf

SetEnv SYBASE=/usr/local/freetds

SetEnv TDSDUMP=/tmp/freetds.log

SetEnv LANG=de_DE@euro

SetEnv LC_ALL=de_DE@euro

SetEnv LC_COLLATE=POSIX

 

7. Links.

 

7.1.      Freetds on SuSE 9.2 http://www.theevilpixel.com/node/60

7.2.      Gentoo - mssql, freetds, unixodbc, php setup http://thinkflat.com/howto/gentoo-mssql-freetds.html

7.3.      Easysoft dbExpress-ODBC Gateway http://www.easysoft.com/support/kb/kb00693.html