Hi there,
I am currently trying to write a module which shall connect to another Database and display data from there.
I managed to created my Modules and Templates and also found out how to change the tables by setting a custom config in the core module.
Unfortunatelly, all tutorials I found are relying on DBObject which is - for sure - a connection to OTRS configured Database.
Since I do want to use OTRS functions as far as possible, I'd like to get OTRS to create a second DBObject which sets up connection to the second database-server. Any Ideas or hints?
btw.: I am working with OTRS 3.3
Connect Module to second Database
-
- Znuny wizard
- Posts: 315
- Joined: 09 Jan 2007, 15:24
- Znuny Version: OTRS 5.0.x
- Real Name: Torsten
- Company: c.a.p.e. IT GmbH
- Location: Chemnitz
- Contact:
Re: Connect Module to second Database
you might check out package DynamicFieldRemoteDB http://opar.perl-services.de/dist/Dynam ... teDB-1.3.0 which does something similar. At least for your DBObject-issue you might find an answer. And yes, there's a release for 3.3 as well .webrene wrote:Hi there,
I am currently trying to write a module which shall connect to another Database and display data from there.
I managed to created my Modules and Templates and also found out how to change the tables by setting a custom config in the core module.
Unfortunatelly, all tutorials I found are relying on DBObject which is - for sure - a connection to OTRS configured Database.
Since I do want to use OTRS functions as far as possible, I'd like to get OTRS to create a second DBObject which sets up connection to the second database-server. Any Ideas or hints?
btw.: I am working with OTRS 3.3
regards, T.
--
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
Re: Connect Module to second Database
Just as a follow up:
I did it by selecting the database in the prepare statement itself like.
The Database Name is set up in SysConfig for the Module and set in the Constructor of my Module Class as 'OtherDatabase' and 'TableName'.
return if !$Self->{DBObject}->Prepare(
SQL => "SELECT p.value1, p.value2 "
. " FROM $Self->{OtherDatabase}.$Self->{TableName} p"
);
I did it by selecting the database in the prepare statement itself like.
The Database Name is set up in SysConfig for the Module and set in the Constructor of my Module Class as 'OtherDatabase' and 'TableName'.
return if !$Self->{DBObject}->Prepare(
SQL => "SELECT p.value1, p.value2 "
. " FROM $Self->{OtherDatabase}.$Self->{TableName} p"
);