Novell Home

Perl to Oracle Proxy

Novell Cool Solutions: Cool Tool

Digg This - Slashdot This

In Brief

JDBC proxy to access Oracle from NetWare Perl scripts.

Vitals

Product Categories:
  • NetWare
  • Functional Categories:
  • Database
  • Posted:14 Jan 2004
    File Size:109KB
    License:GPL, Free
    Download:/coolsolutions/tools/downloads/nw_perl_oracle.zip
    Publisher:Stig Sørensen

    Disclaimer

    Please read the note from our friends in legal before using this file.


    Details

    This little tool/tip explains how to access an Oracle 8i database from a Perl script running on NetWare 6. Since no native driver is available for netware, the best solution is to use DBD::JDBC for Perl (http://search.cpan.org/~vizdom/DBD-JDBC-0.64/).

    This module works well on NetWare, in conjunction with Oracle's Thin JDBC driver.

    To get the Oracle connection up 'n' running, unzip the NWPerlOracle.zip file to the sys volume. It contains the JDBC.pm module and the BER.pm module needed by JDBC.pm.

    The zip file also contains a jdbc folder with the neccessary files for the jdbc-perl proxy.

    Download the Oracle Thin JDBC driver (classes111.zip) from Oracle (http://otn.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm)and put it in the jdbc folder. Then start the proxy by typing "load sys:jdbc/server.ncf" on the console. This can also be added to autoexec.ncf, to start the proxy when the server boots.

    When the proxy is running, you can access Oracle from Perl by using DBI to connect to localhost:9001:

    use DBI;

    my $usrname = '...';
    my $passwd = '...';
    my $url = '...';

    my $connection =
    DBI->connect("dbi:JDBC:hostname=localhost:9001;url=$url",$usrname,$passwd)or die "Could not connect!\n";

    In the code above, $usrname and $passwd must be a valid Oracle user, and $url must be a valid JDBC connection url.

    The above example should also work for other JDBC capable databases, by placing their drivers in sys:jdbc/ and adding them to the class path given in sys:jdbc/server.

    Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

    © 2014 Novell