Customer company nackend - two diffrent databases

Moderator: crythias

Locked
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Customer company nackend - two diffrent databases

Post by GMunjal »

Hi,

We are implemented OTRS, and for customer company we require to show data from two different databases :
1. from OTRS customer_company table - which is default setup - MySQL connection
2. from mssql databse table - which is an external database.

I tried to implement both the databases, but don't know after doing changes in zzzcustomerbackend.pm, I am not able to open the login page.

changes to implement both the DB as below :

Code: Select all

##################################################
####### COMPANY BACKEND
##################################################
    $Self->{CustomerCompany} = {
        Name   => 'Source AX-View for CustomerCompany',
        Module => 'Kernel::System::CustomerCompany::DB',
        Params => {
                      Table => 'customer_company',
                      CaseSensitive => 0,
        },

        # company unique id
        CustomerCompanyKey             => 'customer_id',
        CustomerCompanyValid           => 'valid_id',
        CustomerCompanyListFields      => [ 'customer_id', 'name' ],
        CustomerCompanySearchFields    => ['customer_id', 'name'],
        CustomerCompanySearchPrefix    => '*',
        CustomerCompanySearchSuffix    => '*',
        CustomerCompanySearchListLimit => 250,
        CacheTTL                       => 60 * 60 * 24, # use 0 to turn off cache

        Map => [
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
            [ 'CustomerID',             'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
            [ 'CustomerCompanyName',    'Company',    'name',        1, 1, 'var', '', 0 ],
            [ 'CustomerCompanyStreet',  'Street',     'street',      1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyZIP',     'Zip',        'zip',         1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyCity',    'City',       'city',        1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyCountry', 'Country',    'country',     1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyURL',     'URL',        'url',         1, 0, 'var', '$Data{"CustomerCompanyURL"}', 0 ],
            [ 'CustomerCompanyComment', 'Comment',    'comments',    1, 0, 'var', '', 0 ],
            [ 'ValidID',                'Valid',      'valid_id',    0, 1, 'int', '', 0 ],
        ],
    };

##########second DB connection- mssql as below######################################
############ 1. Customer user backend: new DB
########### (customer user database backend and settings)
	$Self->{CustomerCompany1} = {
        Name   => 'Customer Database Source AX-New View for CustomerCompany',
        Module => 'Kernel::System::CustomerCompany::DB',
        Params => {
		
            # if you want to use an external database, add the
            # required settings
			DSN  => 'DBI:odbc:database=externalDB;host=externalDB.local',
			Type => 'mssql', # only for ODBC connections
			User => 'externalDB_otrs',
			Password => 'externalDB',
                                                Table => 'Cust_Comp_externalDBView',
			CaseSensitive => 0,
            
        },
		
###### company unique id
        CustomerCompanyKey             => 'NAMEALIAS',
        CustomerCompanyValid           => 'CustValid',
        CustomerCompanyListFields      => [ 'NAMEALIAS', 'name' ],
        CustomerCompanySearchFields    => ['NAMEALIAS', 'name'],
        CustomerCompanySearchPrefix    => '*',
        CustomerCompanySearchSuffix    => '*',
        CustomerCompanySearchListLimit => 250,
        CacheTTL                       => 60 * 60 * 24, # use 0 to turn off cache
		
        ReadOnly => 1,

           Map => [
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
            [ 'CustomerID',             'CustomerID', 'NAMEALIAS', 0, 1, 'var', '', 0 ],
            [ 'CustomerCompanyName',    'Company',    'name',        1, 1, 'var', '', 0 ],
            [ 'CustomerCompanyStreet',  'Street',     'street',      1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyZIP',     'Zip',        'zipcode',         1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyCity',    'City',       'city',        1, 0, 'var', '', 0 ],
            # [ 'CustomerCompanyCountry', 'Country',    'country',     1, 0, 'var', '', 0 ],
            # [ 'CustomerCompanyURL',     'URL',        'url',         1, 0, 'var', '$Data{"CustomerCompanyURL"}', 0 ],
            # [ 'CustomerCompanyComment', 'Comment',    'comments',    1, 0, 'var', '', 0 ],
            [ 'ValidID',                'Valid',      'CustValid',    0, 1, 'int', '', 0 ],
        ],
		
};
Can anyone please help me, if there is any mistake on the above settigns. or is there is any other file where we require to do changes to connect both the DB's(MySQL and MSSql).

Thanks in advance.

Regards,
GMunjal
Last edited by crythias on 27 Nov 2013, 12:34, edited 1 time in total.
Reason: added code tags
yuri0001
Znuny superhero
Posts: 630
Joined: 17 Mar 2011, 14:40
Znuny Version: 5.0.6
Real Name: Yuri Kolesnikov
Location: Russia

Re: Customer company nackend - two diffrent databases

Post by yuri0001 »

GMunjal wrote:Hi,

We are implemented OTRS, and for customer company we require to show data from two different databases :
1. from OTRS customer_company table - which is default setup - MySQL connection
2. from mssql databse table - which is an external database.

I tried to implement both the databases, but don't know after doing changes in zzzcustomerbackend.pm, I am not able to open the login page.

Regards,
GMunjal
This changes you must implement in Config.pm file - I don't know what is - zzzcustomerbackend.pm. Usually files with ZZZ prefix is automatically generated files. :?
Best regards Yuri Kolesnikov
OTRS 5.0.14, ITSM 5.0.14
SUSE 13.2, MariaDB 10.0.22(productive)
OTRS 5.0.14, ITSM 5.0.14(test)
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

thanks for the reply.

Do you have any example where both the connection are used in config.pm.
Or what changes do we require to implement in config.pm to use both the databases.


Regards,
Gmunjal
yuri0001
Znuny superhero
Posts: 630
Joined: 17 Mar 2011, 14:40
Znuny Version: 5.0.6
Real Name: Yuri Kolesnikov
Location: Russia

Re: Customer company nackend - two diffrent databases

Post by yuri0001 »

All text that you write in your post - you need to insert in Config.pm file.
Best regards Yuri Kolesnikov
OTRS 5.0.14, ITSM 5.0.14
SUSE 13.2, MariaDB 10.0.22(productive)
OTRS 5.0.14, ITSM 5.0.14(test)
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

Hi,

I placed the below part only in the config.pm, but still error exists. I am not able to open the login page :

Code: Select all

############ 1. Customer user backend: new DB
########### (customer user database backend and settings)
	$Self->{CustomerCompany1} = {
 Name => 'Customer Database Source AX-New View for CustomerCompany',
 Module => 'Kernel::System::CustomerCompany::DB',
 Params => {

 # if you want to use an external database, add the
 # required settings
	DSN => 'DBI:odbc:database=externalDB;host=externalDB.local',
	Type => 'mssql', # only for ODBC connections
	User => 'externalDB_otrs',
	Password => 'externalDB',
 Table => 'Cust_Comp_externalDBView',
	CaseSensitive => 0,

 },

###### company unique id
 CustomerCompanyKey => 'NAMEALIAS',
 CustomerCompanyValid => 'CustValid',
 CustomerCompanyListFields => [ 'NAMEALIAS', 'name' ],
 CustomerCompanySearchFields => ['NAMEALIAS', 'name'],
 CustomerCompanySearchPrefix => '*',
 CustomerCompanySearchSuffix => '*',
 CustomerCompanySearchListLimit => 250,
 CacheTTL => 60 * 60 * 24, # use 0 to turn off cache

ReadOnly => 1,

 Map => [
 # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
 [ 'CustomerID', 'CustomerID', 'NAMEALIAS', 0, 1, 'var', '', 0 ],
 [ 'CustomerCompanyName', 'Company', 'name', 1, 1, 'var', '', 0 ],
 [ 'CustomerCompanyStreet', 'Street', 'street', 1, 0, 'var', '', 0 ],
 [ 'CustomerCompanyZIP', 'Zip', 'zipcode', 1, 0, 'var', '', 0 ],
 [ 'CustomerCompanyCity', 'City', 'city', 1, 0, 'var', '', 0 ],
 # [ 'CustomerCompanyCountry', 'Country', 'country', 1, 0, 'var', '', 0 ],
 # [ 'CustomerCompanyURL', 'URL', 'url', 1, 0, 'var', '$Data{"CustomerCompanyURL"}', 0 ],
 # [ 'CustomerCompanyComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ],
 [ 'ValidID', 'Valid', 'CustValid', 0, 1, 'int', '', 0 ],
 ],

};
Last edited by crythias on 27 Nov 2013, 12:36, edited 1 time in total.
Reason: added code tags
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer company nackend - two diffrent databases

Post by crythias »

GMunjal wrote: I am not able to open the login page
Are you receiving an error? What is the error? Have you looked at apache or otrs or system logs for an error? Is the web server running on the otrs server?
Which are you attempting to log into index.pl or customer.pl?
is your browser connecting to your otrs server?

Are you being redirected to a different login page?

To better assist your request, it would be helpful to understand and potentially replicate your difficulty.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

'Are you being redirected to a different login page?'
No, I am on same login page(index.pl) and shows no error on web interface.

I am trying to login into index.pl page.

The very first point to correct at my end is, Is there is any issue in the config changes that I placed in config.pm.
Secondly, is it mandatory that CustomerCompanyKey => 'NAMEALIAS' must be a unique filed in database table also.

For errors, where can I check 'apache or otrs or system logs for an error?', as the OTRS interface is not working. is the errors also saved in OTRS DB.

Regards,
Gmunjal
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer company nackend - two diffrent databases

Post by crythias »

I still don't know what "I am an unable to open the login page" means to you.
Please read my signature.
GMunjal wrote:The very first point to correct at my end is, Is there is any issue in the config changes that I placed in config.pm.
I don't know. are you getting any errors on starting apache?
GMunjal wrote:Secondly, is it mandatory that CustomerCompanyKey => 'NAMEALIAS' must be a unique filed in database table also.
For CustomerCompany, yes, it should be unique. (For customer company support, each company should be uniquely identified.)
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

Hi,

Thanks for the information, and apologize for the confusion.

Below is the image attached , which occurs after doing changes in config.pm.


Regrads,
Gmunjal
You do not have the required permissions to view the files attached to this post.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer company nackend - two diffrent databases

Post by crythias »

internal server error means look at apache error logs.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company backend - two diffrent databases

Post by GMunjal »

Yes, I check the logs, and it shows not able to connect with database. i.e OTRs is not able to connect with MSSQL database.

What I tried :

I create a table with same name on MSSQL database and on MYSQL OTRS database.

Then first I use
DSN => 'DBI:ODBC:database=ABC;host=abc.local',
But it will not connect
Then I change the DSN part as below :
DSN => 'DBI:mysql:database=otrs;host=localhost',

and it works.

So now the issue is , how can I analyse that why I am not able to connect with MSSQL DB from OTRS. Can you suggest some input on this.

Regards,
Gaurav Munjal
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer company nackend - two diffrent databases

Post by crythias »

You could try searching, which is what I'd have to do to provide information on MSSQL.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

I check all the errors in apache logs :

and it shows me - "[error] install_driver(odbc) failed: Can't locate DBD/odbc.pm in @INC "

I already installed ODBC package, what can I do next for this missing file.

Thanks in advance.

Regards,
Gmunjal
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer company nackend - two diffrent databases

Post by crythias »

GMunjal wrote:and it shows me - "[error] install_driver(odbc) failed: Can't locate DBD/odbc.pm in @INC "

I already installed ODBC package
odbc!=ODBC
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

Thanks for your reply.

That issue gone, but some new occurs :
DBI connect('DATABASE=OTRSDB;host=OTRS.local','otrs',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at /opt/otrs//Kernel/System/DB.pm line 253
ERROR: OTRS-CGI-1 Perl: 5.10.1 OS: linux Time: Wed Nov 27 16:18:06 2013

Any inputs will be helpful to us.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer company nackend - two diffrent databases

Post by crythias »

Please try searching.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

Otrs is installed on Linux system, and when I check the ODBC support as:

odbc -q -d

output will be as below :
[PostGreSQL]
[MySQL]

Is this means it doesn't support MSSQL ?
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Customer company nackend - two diffrent databases

Post by GMunjal »

Issue is due to MSSQL ODBC installation.

Issue resolved.

Thanks for your support.
Locked