MSSQL

Aus Limbas Wiki

Wechseln zu: Navigation, Suche
Diese Seite ist eine übersetzte Version der Seite MSSQL und die Übersetzung ist zu 100 % abgeschlossen sowie aktuell.

Main Page


Ability to use MSSQL

Generally Limbas must be installed on a linux operation system the database on a windows operating system. Additionally the port and the TCP-IP connection of the database must be activated and if neccessary it must be adjusted. As driver the free availabe http://www.freetds.org/ is used.


freetds

Download

You can download freetds at http://www.freetds.org. The package is published under GPL2.
A version adjusted and tested to work with LIMBAS is available at https://sourceforge.net/projects/limbas/files/tools/freetds-0.83-alias.tar.gz/download.
Different versions have to be adjusted according to the instructions below.

Adjust freetds

Bevor freetds installiert wird muß der folgende Patch angewendet werden: http://permalink.gmane.org/gmane.comp.db.tds.freetds/12354 Er sorgt dafür das die Alias Funktionalität korrekt arbeitet.

diff -Nru a/src/odbc/odbc.c b/src/odbc/odbc.c
--- a/src/odbc/odbc.c	2010-03-22 09:42:16.000000000 -0500
+++ b/src/odbc/odbc.c	2010-05-06 16:00:00.000000000 -0500
@@ -2873,12 +2873,9 @@

} odbc_set_sql_type_info(col, drec, stmt->dbc->env->attr.odbc_version);

-		if (!col->table_column_name) {
-			if (!tds_dstr_copyn(&drec->sql_desc_name, col->column_name, col->column_namelen))
-				return SQL_ERROR;
-		} else {
-			if (!tds_dstr_copy(&drec->sql_desc_name, col->table_column_name))
-				return SQL_ERROR;
+		if (!tds_dstr_copyn(&drec->sql_desc_name, col->column_name, col->column_namelen))
+			return SQL_ERROR;
+		if (col->table_column_name) {

if (!tds_dstr_copy(&drec->sql_desc_base_column_name, col->table_column_name)) return SQL_ERROR; }


Required Packages

unixodbc
unixodbc-devel

Compile freetds

After the installation the ODBC driver should be at /usr/local/lib.

./configure --with-tdsver=8.0
make
make install

freetds.conf

After the installation the configuration file "freetds" is create in the path "/usr/local/etc/". It can be adjusted as followed. In the process the IP or the domain name of the SQL server as well as the port the database is listening to are registered. Additionally the character encoding should be registered. If it is not absolutely neccessary you should not use utf8 or unicode. The tds version 8.0 refers to the MSSQL server starting at version 2005.

#   $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
[global]
        # If you get out-of-memory errors, it may mean that your client
        # is trying to allocate a huge buffer for a TEXT field.  
        # Try setting 'text size' to a more reasonable limit 
        text size = 129024
        client charset = ISO-8859-1
[tds_mssql]
        host = 192.168.10.10
        port = 1433
        tds version = 8.0

Adjust UNIX ODBC

odbc.ini

[limbas_mssql]
Driver          = FreeTDS
Description     = limbas
Servername      = tds_mssql
Port            = 1433
Database        = limbas

odbcinst.ini

[FreeTDS]
Description     = MSSQL
Driver          = /usr/local/lib/libtdsodbc.so
Driver64        =
Setup           =
Setup64         =
UsageCount      = 1
CPTimeout       =
CPReuse         =


Rights

The database needs following additional rights for the system tables:

USE master;
GO
GRANT VIEW SERVER STATE TO limbasuser;

Test

isql -v limbas_dsn limbasuser limbaspass