krachen has asked for the wisdom of the Perl Monks concerning the following question:
I'm building a perl script using CGI and DBI. I want to display data selected from an Oracle database in an browser. I've already done it with Mysql. What module do I add to the script to set Oracle home and the other environment variables that I need?
The DBD link showed me what I needed. You guys rock.
Re: Oracle database connection
by dragonchild (Archbishop) on Dec 07, 2004 at 00:41 UTC
|
You will want to use DBD::Oracle and set, at the very least, $ENV{ORACLE_HOME}. Possibly $ENV{NLS_SETTINGS} as well (or whatever it is). The DBD::Oracle POD is very good at explaining it.
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.
| [reply] |
Re: Oracle database connection
by Errto (Vicar) on Dec 07, 2004 at 04:00 UTC
|
To further elaborate (since I did this for the first time recently), my fellow monks are correct that DBD::Oracle is the module you want. In order to install it, however, you must already have set up a full Oracle client installation, including specifically the OCI (Oracle Call Interface) drivers for your platform. You also need to set the $ORACLE_HOME environment variable before trying to even install DBD::Oracle. This tripped me up initially because I had worked with Java on Oracle before, and in Java you have a choice of using OCI or the "thin" driver, which is pure Java and requires no ORACLE_HOME. But there is no pure Perl driver for Oracle, AFAIK. | [reply] |
|
But there is no pure Perl driver for Oracle, AFAIK.
You are absolutely correct, because there are no Oracle drivers outside of C/C++ and Java. So, there aren't any pure Haskell drivers, either.
Installing DBD::Oracle is probably the hardest single module install I've ever done, with the possible exception of DBD::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.
| [reply] |
|
Installing DBD::Oracle is probably the hardest single module install I've ever done
It being so close to Christmas, here is my Oracle/Perl wishlist:
Things are supposed to get lot easier once Oracle releases the overdue Instant Client SDK (not sure when this will be, though). Then, you can just install a few RPMs and DBD::Oracle should be able to build out of the box, without much fiddling with the build files and parameters.
And things are also supposed to get even more easy with Perl6/Parrot where the DBD::Oracle does not even need a (C) compiler anymore to install, relying on Parrot's cool dynamic library loaders. But here we are not talking about this year's Christmas...
| [reply] |
Re: Oracle database connection
by Grygonos (Chaplain) on Dec 06, 2004 at 21:46 UTC
|
DBD::Oracle , DBD::ODBC I'm not that familiar with Oracle but if its really an environment variable ala
$ENV{'ORACLE_HOME'}
then can you not just
ENV{'ORACLE_HOME'} = /some/path/up/the/tree
?
| [reply] [d/l] [select] |
|
You can do something like this for the script:
BEGIN {
$ENV{ORACLE_HOME} = "E:\\Oracle\\Ora92\\";
} # See man page for DBD::Oracle and seeting of ENV variables.
In this case I was on a Windoze box, but it works the same on *nix
To make DBD::Oracle work I needed to have Oracle installed. | [reply] [d/l] |
|
|