[SOLVED]third party module using an oracle database

English! place to talk about development, programming and coding
Post Reply
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

[SOLVED]third party module using an oracle database

Post by eandrex »

Ok, i have otrs 3.3.8 running on iis(ActivePerl 5.16 32 bits with perlex.dll)+mysql+Windows Server 2012 64 bits.

i started coding a module which should be able to bring data from an oracle database.

so first step, was to install oracle instant client 11.2.0.4.0 (32 bits)
after that, i created a new environment variable ORACLE_HOME which points where i unzipped the instant client(i also added it to the PATH variable) and if i run otrs.CheckModules.pl, i see "Ok" for DBD::Oracle

now, i have something like this in my frontend module

Code: Select all

$Self->{OracleDbObject} = Kernel::System::DB->new(
%Param,
DatabaseDSN  => 'DBI:Oracle:sid=xxx;host=myhost;port=1522',
DatabaseUser => 'user',
DatabasePw   => 'password',
Type         => 'oracle',
AutoConnectNo => 0,
);
but whenever i try to test it by going to customer.pl?Action=MyModule, i see an error 500, and if i see perlex logs, there is something like

Code: Select all

Can't load 'c:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll'
i tried adding this to my Config.pm

Code: Select all

$ENV{ORACLE_HOME} = 'path to my instant client';
but still doesnt work. it is weird since im using 32 bits perl and 32 bits instant client..(could it be related that both are running on a 64bits machine?)

after i gave up trying to debug why it is not working, i tried another way..using the odbc driver that oracle provides..
after i installed it, my DSN looks like this:

Code: Select all

DBI:ODBC:driver={Oracle in instantclient_12_1};sid=xxx;host=myhost;port=1522
and if try running again customer.pl?Action=MyModule..i dont get error 500 anymore but instead i see this in error logs

Code: Select all

ORA-12560: TNS:protocol adapter error
and yes, i asked the dba to provide me the tsnames.ora of their oracle installation to put it on <ORACLE_HOME>/network/admin. (should i edit tsnames.ora?)
i also added a new environment variable called TNS_ADMIN which points to <ORACLE_HOME>/network/admin.

Googling a bit, i see that ORA-12560 indicates that the database is not running.. but i doubt so.

So, can anyone point me to the right direction? what am i missing? what should i try? is it better to get DBI::Oracle working over ODBC?

Thank you
Last edited by eandrex on 15 Oct 2014, 22:51, edited 1 time in total.
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: third party module using an oracle database

Post by eandrex »

Ok, i got it working using ODBC (DBD:Oracle never worked even by building it manually).

So here is how i solved it:

1) if you are using perlex.dll, Make sure you install the 32 bits oracle odbc driver (it is on the same download page of the instantclient, read the README!)
2) go to control panel / administrative tools / double click to ODBC Data Sources (if you are on windows 8/2012, select the 32 bits)
3) go to System DSN tab and click and add a new one
4) complete your form according to your tsnames.ora
5) now in otrs, in your DSN set it to DBI:ODBC:<your datasource name>

where <your datasource name> is the name you gave on the step 4.

6) start using your oracle database from otrs

edit: if on step 3 you get an error with code 14001, install microsoft redistributable c++ 2005 sp1
Post Reply