Changes

From SME Server
Jump to navigationJump to search
370 bytes added ,  13:17, 18 June 2009
m
adjustments
Line 3: Line 3:  
===Description===
 
===Description===
 
Adding support in SME Server for a universal connection to foreign datebase servers using Open Database Connectivity (ODBC).
 
Adding support in SME Server for a universal connection to foreign datebase servers using Open Database Connectivity (ODBC).
 +
 +
This HowTo focus on building PHP support for ODBC.
    
===Used packages===
 
===Used packages===
unixODBC.i386 - is an API that provides a common interface to many different databases. [http://www.unixODBC.org unixODBC official site]  
+
'''unixODBC.i386''' - is an API that provides a common interface to many different databases. [http://www.unixODBC.org unixODBC official site]  
   −
unixODBC-devel.i386
+
'''unixODBC-devel.i386'''
   −
php-odbc.i386 - is simply an extension for PHP that allows you to use unixODBC to connect to database servers.
+
'''php-odbc.i386''' - is simply an extension for PHP that allows you to use unixODBC to connect to database servers.
   −
freetds - a re-implementation of the Tabular Data Stream protocol made by Sybase and Microsoft. [http://www.freetds.org/ FreeTDS official site]
+
'''freetds''' - a re-implementation of the Tabular Data Stream protocol made by Sybase and Microsoft. [http://www.freetds.org/ FreeTDS official site]
   −
Optional: gcc - The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries for these languages. [http://gcc.gnu.org/ GCC official site]
+
Optional: '''gcc''' - The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries for these languages. [http://gcc.gnu.org/ GCC official site]
    
===Installation===
 
===Installation===
Line 23: Line 25:     
php-odbc.i386
 
php-odbc.i386
 +
 +
gcc.i386 (only needed if you are going to install from source)
    
====Alt 1: Install FreeTDS precompiled====
 
====Alt 1: Install FreeTDS precompiled====
It save some work and you don't need gcc but usually contain an older version.
+
It save some work and you don't need gcc but usually contain an older version. Testing suggests it still works for SQL Server 2005.
 
Install FreeTDS from Dag repository:
 
Install FreeTDS from Dag repository:
 
  yum --enablerepo=dag install freetds freetds-devel
 
  yum --enablerepo=dag install freetds freetds-devel
Line 33: Line 37:  
====Alt 2: Install FreeTDS from source====
 
====Alt 2: Install FreeTDS from source====
 
This will give you full control and the latest version (or any version, modify path as you like).
 
This will give you full control and the latest version (or any version, modify path as you like).
yum install gcc
      
  wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-0.82.tar.gz
 
  wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-0.82.tar.gz
Line 40: Line 43:     
  tar -xvf  freetds-0.82.tar
 
  tar -xvf  freetds-0.82.tar
  −
yum install gcc
      
  cd freetds-0.82
 
  cd freetds-0.82
Line 84: Line 85:  
====freetds.conf====
 
====freetds.conf====
 
This file contains the settings that tell freetds about each server it will connect to. Ip can (should) be replaced with FQDN.
 
This file contains the settings that tell freetds about each server it will connect to. Ip can (should) be replaced with FQDN.
 
+
Make directory to hold template fragment for the original file: /etc/freetds.conf
 
  mkdir -p /etc/e-smith/templates-custom/etc/freetds.conf
 
  mkdir -p /etc/e-smith/templates-custom/etc/freetds.conf
 +
Make and edit template fragment, "10xp3c" is my example:
 
  pico /etc/e-smith/templates-custom/etc/freetds.conf/10xp3c
 
  pico /etc/e-smith/templates-custom/etc/freetds.conf/10xp3c
 +
 
Add your foreign database server (modify to suit your conditions):
 
Add your foreign database server (modify to suit your conditions):
# Microsoft SQL Server 2005 Express on a Win XP machine
+
# Microsoft SQL Server 2005 Express on a Win XP machine
 
  [xp3c]
 
  [xp3c]
 
         host = 192.168.0.112
 
         host = 192.168.0.112
Line 101: Line 104:     
  mkdir -p /etc/e-smith/templates-custom/etc/odbcinst.ini
 
  mkdir -p /etc/e-smith/templates-custom/etc/odbcinst.ini
 +
 
  pico /etc/e-smith/templates-custom/etc/odbcinst.ini/20sqlserver
 
  pico /etc/e-smith/templates-custom/etc/odbcinst.ini/20sqlserver
    
Add driver path (modify to suit your conditions):
 
Add driver path (modify to suit your conditions):
 +
 
  [FreeTDS]
 
  [FreeTDS]
Description  = Ms SQL Server access with FreeTDS driver
+
        Description  = Ms SQL Server access with FreeTDS driver
Driver        = /usr/lib/libtdsodbc.so
+
        Driver        = /usr/lib/libtdsodbc.so
    
  expand-template /etc/odbcinst.ini
 
  expand-template /etc/odbcinst.ini
Line 114: Line 119:     
  mkdir -p /etc/e-smith/templates-custom/etc/odbc.ini
 
  mkdir -p /etc/e-smith/templates-custom/etc/odbc.ini
 +
 
  pico /etc/e-smith/templates-custom/etc/odbc.ini/20sqlserver
 
  pico /etc/e-smith/templates-custom/etc/odbc.ini/20sqlserver
    
Add text (modify to suit your conditions):
 
Add text (modify to suit your conditions):
 +
 
  [sqlserver]
 
  [sqlserver]
Driver = FreeTDS
+
        Driver = FreeTDS
Description = Connection to DB_KALLE on server xp3c
+
        Description = Connection to DB_KALLE on server xp3c
Trace = No
+
        Trace = No
Server = 192.168.0.112
+
        Server = 192.168.0.112
Database = db_kalle
+
        Database = db_kalle
Port = 1433
+
        Port = 1433
TDS_Version = 8.0
+
        TDS_Version = 8.0
    
  expand-template /etc/odbc.ini
 
  expand-template /etc/odbc.ini
206

edits

Navigation menu