Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
The stupid question is the question not asked
 
PerlMonks  

What are DBD::Oracle's dependencies (on Linux)?

by nguye103 (Acolyte)
on Oct 01, 2004 at 18:11 UTC ( #395684=perlquestion: print w/ replies, xml ) Need Help??
nguye103 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I just started using perl and linux a few weeks ago, so I am not very experienced. I need to access an Oracle database on another system from Linux. I know that I need to install DBD-Oracle, but I don't know what else I need in order to install DBD-oracle because the Linux does not have Oracle. What I want to know is what I need to install and where I can find what I need to install to get DBD-Oracle to work. Any help would be appreciated. Thank you.

Janitored by Arunbear - retitled from 'DBD-Oracle'

Comment on What are DBD::Oracle's dependencies (on Linux)?
Re: What are DBD::Oracle's dependencies (on Linux)?
by ikegami (Pope) on Oct 01, 2004 at 18:16 UTC

    Nothing else. From the DBD::Oracle docs,

    $dbh = DBI->connect("dbi:Oracle:host=myhost.com;sid=ORCL", $user, $pas +swd);

    Note "myhost.com". The database does not have to be on the local machine. DBD::Oracle will contact the database over a network or over the internet.

      So that means that I still need to install DBD-Oracle? When I try to install DBD_Oracle, it says that the ORACLE_HOME environment variable must be set. I don't know where or how to do this. I read that I need to install the Oracle client, but I don't know where to find this.
        The documentation tells you. See http://search.cpan.org/~timb/DBD-Oracle-1.15/Oracle.pm
        The ORACLE_HOME environment variable should be set correctly. In general, the value used should match the version of Oracle that was used to build DBD::Oracle. If using dynamic linking then ORACLE_HOME should match the version of Oracle that will be used to load in the Oracle client libraries (via LD_LIBRARY_PATH, ldconfig, or similar on Unix).
        Followed by example
        $ENV{ORACLE_HOME} = '/home/oracle/product/7.x.x';
        Get it now?
      You still need to install, at the least, the client software so that DBD::Oracle can link against it. Most of the DBD::*s are just layers over the client libraries. Most are written in XS, for that very reason.

      This, incidentally, is why most DBI work on Windows tends to use ODBC, because ActiveState has DBD::ODBC already compiled and most RDBMSes will talk in ODBC.

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re: What are DBD::Oracle's dependencies (on Linux)?
by dragonchild (Archbishop) on Oct 01, 2004 at 18:19 UTC
    You will need to install, at the very least, the Oracle client. However, I've had issues with the Oracle 9i client not installing all the needed C source files, so I generally install the whole server (no database), build DBD::Oracle, then delete the server installation.

    You can grab the needed installers from Oracle's website.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      What server is it? There are a number of servers on the website.
        The oracle C libraries are only visible as part of the "advanced" oracle install options. Which version of Oracle you need depends on what flavor of linux you are running and what version of oracle your server is.

        L

        There are two ways to do this - the hard way and the easy way. First, the hard way:
        1. Go to http://www.oracle.com
        2. At the top, click on "Developers"
        3. At the bottom, click on Database (under "Product Centers")
        4. On the left, click on Downloads (in the navigation bar called "Services")
        5. Pick the right installer for your version of Linux and your hardware
        6. Download it after you affirm that you're not a terrorist
        7. Get X working on your Linux box (if you don't already have it working).
        8. Go to www.puschitz.com/OracleOnLinux.shtml and follow the directions there. Depending on your Oracle and Linux versions, there will be between 10 and 50 discrete steps. You will need to be familiar with the innards of Linux.
        9. Attempt to install Oracle.
        10. Curse. A lot.
        11. Remove the installation after cursing because you forgot step 34a1b.
        12. Do it over again.

        The easy way: find someone who's done this before (like me), pay them $100 to do it, and get on with your life.

        I'm serious - installing Oracle on Linux is an absolute pain in the ass. I can do it in under 4 hours and on the first try (usually) because I've done it some 10 times in the last 6 months. The only thing worse is installing Oracle on Windows Server 2003. (Possibly worse is being an Exchange administrator, but it's a toss-up.)

        Being right, does not endow the right to be rude; politeness costs nothing.
        Being unknowing, is not the same as being stupid.
        Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
        Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re: What are DBD::Oracle's dependencies (on Linux)?
by Rhys (Pilgrim) on Oct 01, 2004 at 19:15 UTC
    I just got through this myself not too long ago. It was such a giant PITA that I created an RPM for it once everything finally worked.

    Basically, the only thing you need from the Oracle CDs are the C libraries and headers. You need these in order to build DBD::Oracle. I also recommend adding a script to /etc/profile.d that will set your ORACLE_HOME and ORACLE_BASE environment variables.

    Once you have the Oracle client pieces installed properly (don't forget to edit tnsnames.ora!), you should be able to use CPAN to install DBD::Oracle. The 'make test' part will fail if you have not set the ORACLE_SID variable, but if you look through the build output and that's the only thing that fails, just do force install DBD::Oracle and it will work. (At least, it works for me.)

    Really, the hard part is getting all of the Oracle client to install properly. When I installed 9.2, the biggest problem was working around the _libcwait Java problem. Oracle has a 'patch' for it that builds a library with that function and preloads it. It's kind of silly, and only necessary for the installation. It's also a good idea to create the 'oracle' user ID and the 'oinstall' group on your system before running the installer. Also, DO NOT RUN THE INSTALLER FROM THE CD-ROM. Stay in your home directory and use the absolute path to run it. E.g.:

    cd /mnt/cdrom ; ./runInstaller BAD! BAD! BAD! cd ~root ; /mnt/cdrom/runInstaller WORKS PROPERLY.

    The reason is that if the current directory is in the CD-ROM when you run the installer, it won't be able to properly unmount the CD when it's time to change discs, things get weird, and you have to start over.

    But to help you with anything more specific, I'm afraid we need to know what version of the Oracle client you're trying to install, since they are all different.

    NOTE: The "Instant Client" won't work, because it comes with none of the libraries and headers you need to build DBD::Oracle. It's a functioning client, but that won't help you write Perl. ;-)

    --J

      It is possible to run DBD::Oracle with the Oracle Instant Client after DBD::Oracle has been built with the development headers. Oracle has said they are going to release an SDK for Instant Client that can build DBD::Oracle. Last I heard about that was few months ago; I guess they move slowly.

      Also, I had success in not using the Oracle installer and pulling the needed files out of Oracle database distribution archives.

      thank you so much for your help. If possible could you answer some questions that I have? I believe we have oracle 8 or 9. I will have to ask the system administrator about that if you really need to know. 1. I was wondering if there was a way to get the C librabries and headers from the Oracle webstite, or do I need to get them off the cd. 2. How would I make a script? Is making a script like writing a program? 3. Where do I locate tnsnames.ora and in what way do i change it?
        1. I was wondering if there was a way to get the C librabries and headers from the Oracle webstite, or do I need to get them off the cd.

          You will want to get them off the CD.

        2. How would I make a script? Is making a script like writing a program?

          Perl is a programming language. Thus, making a Perl script is programming in Perl. I would strongly urge you to read Learning Perl, which you can find at any bookstore.

        3. Where do I locate tnsnames.ora and in what way do i change it?

          tnsnames.ora is an Oracle configuration file that maps database aliases to where they're really located. Only the DBA should ever modify this file. If you want to modify it, you should really talk to your DBA to do so. If you want to see it, it's located in $ORACLE_HOME/network/admin. (Yes, there's that $ORACLE_HOME thing again.)

        nguye103 - have you talked to your DBA yet? Do you guys even have a DBA? Working with Oracle is non-trivial. If you're just looking for a database that anyone can administer, I would go with one of the opensource options, like MySQL or PostgreSQL. Oracle is the top-of-the-line mothership of all databases, and requires a lot of knowledge to run it correctly. This is reflected in the amount of crap you have to do just to install DBD::Oracle.

        To compare, installing MySQL and DBD::mysql takes about 30 minutes, tops. And, it's even optimized for and meant to be installed on most flavors of Linux. Maybe what you need can be solved by MySQL ...

        Being right, does not endow the right to be rude; politeness costs nothing.
        Being unknowing, is not the same as being stupid.
        Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
        Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://395684]
Approved by Arunbear
Front-paged by kutsu
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (17)
As of 2014-04-16 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (430 votes), past polls