rlambert7 has asked for the wisdom of the Perl Monks concerning the following question:

I need to connect to a remote Oracle DB on a Unix server from my PC. I know I need the DBI module, but no I need anything else? Do I need any other modules? Do I need Oracle instlled on my PC?

Thanks.

Replies are listed 'Best First'.
Re: Connect to remote Oracle DB
by Trimbach (Curate) on Oct 28, 2007 at 00:18 UTC
    Yeah, you'll need Oracle installed on your local computer... at least the client part. DBI just acts as a bridge between Perl and the Oracle client and when you install DBD::Oracle it will look for your Oracle client to compile against. It's a little bit of a pain to setup, but if you know anything about Oracle it's not too hard. I think you can get a free-for-personal-use version of Oracle (including the client) from oracle.com.

    Gary Blackburn
    Trained Killer

Re: Connect to remote Oracle DB
by siva kumar (Pilgrim) on Oct 28, 2007 at 10:12 UTC
    1. Install Oracle Client.
    2. Install Oracle DBD.
    3. Grant permission to the Unix box from the remote Oracle DB.
    grant ALL ON DB.* to 'user'@'UNIX BOX IP' identified by 'password'
    4. Connect Oracle database by specifying the remote host.
    use DBI; $dbh = DBI->connect("DBI:mysql:host=IP ADDRESS;database=$dbname","user +name","password");
Re: Connect to remote Oracle DB
by jhourcle (Prior) on Oct 28, 2007 at 15:54 UTC

    siva kumar has given a pretty thorough answer -- but I don't like hard coding the hostname into my programs. If you're already using a tnsnames.ora file, put a copy of it in /etc, and then use the SID to connect. (if you're setting the SID via environmental variables, you need to set TWO_TASK, not ORACLE_SID, as this is a remote database)