[rt-users] Using DBI for DB2 connection in scripts?

Thomas Bätzler t.baetzler at bringe.com
Wed Dec 28 04:07:29 EST 2016


Hello Alex,

Am 27.12.2016 um 22:54 schrieb Alex Hall:
> Hello list,
> I've just gotten a DSN to our iSeries working on the same server that
> hosts RT. Next, I'll be making a script to auto-set a custom field with
> a value pulled from that iSeries based on another field. This way, for
> instance, you can make a ticket with the order number in a CF, and the
> customer rep gets added to the ticket. The rep comes from the iSeries.
>
> What I'm wondering is whether the DBI module in RT can already do this?
> Can I give it a DSN and some SQL, then get the results? Or do I need to
> install a separate database Perl module and use that? I know next to
> nothing about Perl, let alone how to use it to talk to databases, so
> this may be a stupid question. Still, I thought it worth asking; if the
> DB module that RT already uses can do this, there's no need to install
> another one. Side note: if anyone has ever dealt with DB2 from Perl in
> RT before, any other suggestions or warnings you can offer will be
> appreciated. Thanks.

DBI is a database abstraction layer; the real work is done by database 
secificy DBD modules, i.e. DBD::MySQL, DBD::Pg, ...

So the good news is that there is a DBD::DB2 module:

http://search.cpan.org/~ibmtordb2/DBD-DB2/

The bad news is that you'll likely have to "roll your own" and that the 
CPAN page list a number of open bugs for it. Maybe the following 
document can help to get you started:

http://www-01.ibm.com/support/docview.wss?rs=71&uid=swg21297335

Before you start, you should make sure that you know which perl 
interpreter your RT was built against. If you did an install from source 
and did not set a $PERL environment variable, you should be fine working 
with the system default perl.


HTH,
Thomas


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus




More information about the rt-users mailing list