Customer Database backend connection MSSQL (ODBC - How to?)

Moderator: crythias

Post Reply
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Customer Database backend connection MSSQL (ODBC - How to?)

Post by rzima »

Hi,
I'm trying to add to OTRS 5 customer database located on a MS SQL Sever.
Should I install additional modules or ODBC Driver?
I checked modules by command: ./otrs.CheckModules.pl. Module DBD::ODBC is installed, is that enough?

Code: Select all

 o Apache::DBI......................ok (v1.12)
  o Apache2::Reload..................ok (v0.13)
  o Archive::Tar.....................ok (v1.90)
  o Archive::Zip.....................ok (v1.30)
  o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
  o Crypt::SSLeay....................ok (v0.58)
  o Date::Format.....................ok (v2.24)
  o DBI..............................ok (v1.630)
  o DBD::mysql.......................ok (v4.025)
  o DBD::ODBC........................ok (v1.45)
  o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
  o DBD::Pg..........................Not installed! Use: 'apt-get install -y libdbd-pg-perl' (optional - Required to connect to a PostgreSQL database.)
  o Encode::HanExtra.................ok (v0.23)
  o IO::Socket::SSL..................ok (v1.965)
  o JSON::XS.........................ok (v2.34)
  o List::Util::XS...................ok (v1.27)
  o LWP::UserAgent...................ok (v6.13)
  o Mail::IMAPClient.................ok (v3.35)
    o IO::Socket::SSL................ok (v1.965)
  o ModPerl::Util....................ok (v2.000008)
  o Net::DNS.........................ok (v0.68)
  o Net::LDAP........................ok (v0.58)
  o Template.........................ok (v2.24)
  o Template::Stash::XS..............ok (undef)
  o Text::CSV_XS.....................ok (v1.02)
  o Time::HiRes......................ok (v1.9725)
  o Time::Piece......................ok (v1.20_01)
  o XML::LibXML......................ok (v2.0108)
  o XML::LibXSLT.....................ok (v1.84)
  o XML::Parser......................ok (v2.41)
  o YAML::XS.........................ok (v0.41)
I copied (Customer Database Backend - Section) from Default.pm to Config.pm.
How to configure parameters to connect with ODBC.
I got the following data to the database connection:
This is a separate instance of the database with a prepared view:

SRV-002\PROFT
Server name/hostname: SRV-002
IP 192.168.1.10
User: otrs
Pass: start****

Code: Select all

$Self->{CustomerUser} = {
        Name   => 'Database Backend',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            # if you want to use an external database, add the
            # required settings
#            DSN  => 'DBI:odbc:yourdsn',
#            Type => 'mssql', # only for ODBC connections
#            DSN => 'DBI:mysql:database=customerdb;host=customerdbhost',
#            User => '',
#            Password => '',
            Table => 'customer_user',
#            ForeignDB => 0,    # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields

            # CaseSensitive will control if the SQL statements need LOWER()
            #   function calls to work case insensitively. Setting this to
            #   1 will improve performance dramatically on large databases.
            CaseSensitive => 0,
        },
I tried to set up but still gets the Internal Server Error. Even when only copied the backend section (from Defalut.pm to Config.pm) without modification.
I'm a beginner with otrs. I will be grateful for your help :)
wurzel
Znuny guru
Posts: 3228
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by wurzel »

Hi,

you need a MSSQL database driver.

for example unixODBC


Flo
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
root
Administrator
Posts: 3954
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by root »

I've followed multiple time the original documentation. In addition to that there is a commercial, supported MS SQL ODCB driver from Easysoft
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by rzima »

Thanks!
Solution for problem (Ubuntu 14.04 64bit):

Code: Select all

apt-get install php5-sybase unixodbc tdsodbc
Edit /etc/odbcinst.ini and add driver details

Code: Select all

[TDS]
Description = FreeTDS Driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
Edit /etc/odbc.ini and enter connection details

Code: Select all

[SQLSRV02]
Description = SQL Server test
Driver = TDS
Trace = No
Server = 192.168.1.10\PROFT	#ip adress\name of instance
TDS_Version = 9.0
#Database = DataBaseName
#ReadOnly = Yes
Install ODBC:

Code: Select all

odbcinst -i -s -f /etc/odbc.ini
Test

Code: Select all

isql -v SQLSRV02 OTRS pass
http://stackoverflow.com/questions/2281 ... allocation

Now I have problem with configuration file Config.pm.
I copied section database backend from Default.pm to Config.pl and then otrs shows Internal Server Error.
I try modified parameters in backend section (Config.pm) see below, but still is Internal Server error:
Modified parameters:
DSN => 'DBI:odbc:SQLSRV02', <- is this correct? SQLSRV02 is name of ODBC connection configured in /etc/odbc.ini
Type => 'mssql', # only for ODBC connections
User => 'OTRS',
Password => '****',
Table => 'vwOTRSKlienciUzytkownicy',

Code: Select all

    $Self->{CustomerUser} = {
        Name   => 'Database Backend',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            # if you want to use an external database, add the
            # required settings
            DSN  => 'DBI:odbc:SQLSRV02',
            Type => 'mssql', # only for ODBC connections
#            DSN => 'DBI:mysql:database=customerdb;host=customerdbhost',
            User => 'OTRS',
            Password => '****',
            Table => 'vwOTRSKlienciUzytkownicy',
#            ForeignDB => 0,    # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields

            # CaseSensitive will control if the SQL statements need LOWER()
            #   function calls to work case insensitively. Setting this to
            #   1 will improve performance dramatically on large databases.
            CaseSensitive => 0,
        },

        # customer unique id
        CustomerKey => 'login',

        # customer #
        CustomerID             => 'customer_id',
        CustomerValid          => 'valid_id',
...
Help!
wurzel
Znuny guru
Posts: 3228
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by wurzel »

Hi,

what's in the log?

Flo
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by rzima »

Logs:
/var/log/apache2/otrs-err.log

Code: Select all

[Mon Oct 17 18:50:30.329617 2016] [:error] [pid 11846] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 19:01:39.599539 2016] [perl:error] [pid 10258] [client 192.168.56.1:12884] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 19:01:41.630980 2016] [perl:error] [pid 11862] [client 192.168.56.1:12895] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
/var/log/apache2/otrs-acc.log

Code: Select all

192.168.56.1 - - [17/Oct/2016:18:50:30 +0200] "GET /otrs/customer.pl HTTP/1.1" 500 724 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
192.168.56.1 - - [17/Oct/2016:18:50:30 +0200] "GET /favicon.ico HTTP/1.1" 404 425 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
192.168.56.1 - - [17/Oct/2016:18:50:30 +0200] "GET /favicon.ico HTTP/1.1" 404 424 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
192.168.56.1 - - [17/Oct/2016:19:01:39 +0200] "GET /otrs/index.pl HTTP/1.1" 500 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
192.168.56.1 - - [17/Oct/2016:19:01:41 +0200] "GET /otrs/index.pl HTTP/1.1" 500 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0"
/var/log/apache2/error.log

Code: Select all

[Mon Oct 17 18:31:05.226448 2016] [perl:error] [pid 11843] [client 192.168.56.1:12566] Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 18:31:05.394049 2016] [perl:error] [pid 11915] [client 192.168.56.1:12568] Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 18:31:05.491260 2016] [perl:error] [pid 10256] [client 192.168.56.1:12574] Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 18:31:07.222846 2016] [perl:error] [pid 10258] [client 192.168.56.1:12588] Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 18:31:09.918235 2016] [perl:error] [pid 11862] [client 192.168.56.1:12589] Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 18:38:05 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:38:13.056864 2016] [perl:error] [pid 11915] [client 192.168.56.1:12620] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n, referer: http://adm.pomoc.proferis.pl/otrs/index.pl?Action=Admin
[Mon Oct 17 18:38:15.536890 2016] [perl:error] [pid 10256] [client 192.168.56.1:12621] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n, referer: http://adm.pomoc.proferis.pl/otrs/index.pl?Action=Admin
[Mon Oct 17 18:38:19 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:38:24 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:38:37.768837 2016] [perl:error] [pid 10258] [client 192.168.56.1:12640] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n, referer: http://adm.pomoc.proferis.pl/otrs/index.pl?Action=Admin
[Mon Oct 17 18:38:41.239291 2016] [perl:error] [pid 11862] [client 192.168.56.1:12660] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n, referer: http://adm.pomoc.proferis.pl/otrs/index.pl?Action=AdminLog
[Mon Oct 17 18:38:43.790909 2016] [perl:error] [pid 11843] [client 192.168.56.1:12662] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n, referer: http://adm.pomoc.proferis.pl/otrs/index.pl?Action=AdminLog
[Mon Oct 17 18:48:40 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:50:00.884900 2016] [:error] [pid 10258] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 18:50:02.468032 2016] [:error] [pid 11862] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 18:50:26.113145 2016] [:error] [pid 11843] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 18:50:27 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:50:27.080191 2016] [:error] [pid 10263] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 18:50:30 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:50:30 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 18:58:50.124710 2016] [:error] [pid 10256] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 19:01:32.913817 2016] [perl:error] [pid 11915] [client 192.168.56.1:12863] Attempt to reload /opt/otrs/Kernel/Config.pm aborted.\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n
[Mon Oct 17 19:01:34 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Mon Oct 17 19:01:34.784375 2016] [:error] [pid 10257] Undefined subroutine &Kernel::Config::Translatable called at /opt/otrs/Kernel/Config.pm line 111.\n
[Mon Oct 17 19:01:39 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
/opt/otrs/var/log/SchedulerTaskWorkerERR.log

Code: Select all

...
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:02 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 18:38:03 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: Bad name after login' at /opt/otrs/Kernel/Config.pm line 115.
[Mon Oct 17 18:38:03 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 18:38:03 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
[Mon Oct 17 19:01:21 2016] otrs.Daemon.pl: Kernel::System::Cache depends on Kernel::Config, but Kernel::Config could not be loaded: syntax error at /opt/otrs/Kernel/Config.pm line 152, near "=> >"
[Mon Oct 17 19:01:21 2016] otrs.Daemon.pl: Compilation failed in require at /opt/otrs/Kernel/System/ObjectManager.pm line 191.
[Mon Oct 17 19:01:21 2016] otrs.Daemon.pl:  at /opt/otrs/Kernel/System/Cache.pm line 59.
Can anyone put the file Config.pm with configuration Customer Backend. For comparison. Thanks! :)
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by reneeb »

Can you post your complete Config.pm? (Please remove any sensitive data).
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by rzima »

Config.pm in Attachment.
When I delete "Customer Backend" section, than everything works.
You do not have the required permissions to view the files attached to this post.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by reneeb »

Remove all the "Translatable" and the parens from the Mapping...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by rzima »

Thanks for advice :)
Now working. I changed parameter CacheTTL also to 3600.
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by jbaptiste »

reneeb wrote:Remove all the "Translatable" and the parens from the Mapping...
But why the Translatable function can't be used on Config.pm ?
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Customer Database backend connection MSSQL (ODBC - How to?)

Post by reneeb »

Because Translatable is a function in Kernel::Language that requires Kernel::Config. That leads to a infinite loop.

You can define a sub Translatable in your Kernel/Config.pm

Code: Select all

sub Translatable {
    return shift;
}
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Post Reply