Re: Perl Module for Oracle DB Connection?
by kennethk (Abbot) on Mar 30, 2011 at 15:49 UTC
|
Are you sure you mean DBI::Oracle, or do you mean DBI and DBD::Oracle? I am writing this on a Windows XP 32-bit machine running ActivePerl 5.8.9 and have been using DBD::Oracle seamlessly for years to connect to our Oracle 10g DB. As you are using ActiveState, did you attempt to install the package using PPM? How do you know it wasn't working? Your connector should look something like:
my $db_name = 'host=db.url.com;port=1521;sid=user';
my $db_user = 'userid';
my $db_pass = 'passwd';
my @dbi_path = ("dbi:Oracle:$db_name",$db_user,$db_pass);
my $oracle = DBI->connect( @dbi_path,
{
PrintError => 0,
RaiseError => 0,
AutoCommit => 0,
}
)
or die "Database connect to $db_name failed:" . $DBI::errstr;
| [reply] [d/l] |
Re: Perl Module for Oracle DB Connection?
by marto (Cardinal) on Mar 30, 2011 at 15:49 UTC
|
Perhaps if you tell us what went wrong when you tried to get DBD::Oracle (since DBI::Oracle doesn't exist) working we'd be able to offer advice. As mentioned in the README there are various platform/architecture specific documents you should be reading.
Update: Perl 5.8.8 is from 2006, you may wish to consider upgrading.
| [reply] |
Re: Perl Module for Oracle DB Connection?
by runrig (Abbot) on Mar 30, 2011 at 16:18 UTC
|
I don't have a tnsnames.ora file on my windows box, so the connect syntax I use is: DBI->connect("dbi:Oracle:$host:$port/$service_name", $user, $password,
+ {RaiseError => 1});
ActiveState comes with DBI and DBD::Oracle these days, so I'll assume it's not a library installation problem (unless you have an old build of ActiveState perl).
Also, you don't mention the error you're getting...so what is it? | [reply] [d/l] |
Re: Perl Module for Oracle DB Connection?
by cavac (Prior) on Mar 30, 2011 at 17:16 UTC
|
DBD::Oracle in this ancient ActivePerl version is actually quite broken and has it's share of problems with newer Oracle server versions (including random crashes when using it for long sessions). If been struggling with all kinds of odd behavior for years, now. When i upgraded to ActivePerl 5.12 and also installed the latest Oracle client, all (most) of the problems just vanished.
Can you connect to tha database using sqlplus? Does tnsping work? It's hard to give you more than generic advice without more information.
On a side note (my personal opinion): Always treat DBD::ODBC as a last-ditch attempt when there are better suited packages available. ODBC is very generic, most database specific optimization technics wont work, your software will be slow and you will hog quite a lot of resources on the database server if you are unlucky. Please don't make your database admin break into tears...
| [reply] |
|
|
| [reply] |
|
|
Yes and no. For my latest projects with PostgreSQL i measured a speed difference of 2-5% in my evaluation tests.
This page here also claims some speed difference for Oracle.
If (and how much) speed difference you will experience will depend on the amount of data as well as the complexity of the database.
| [reply] |
|
|
|
|
| [reply] |
Re: Perl Module for Oracle DB Connection?
by fidesachates (Monk) on Mar 30, 2011 at 16:19 UTC
|
Thinking outside the box, I've had problems too with the modules for connecting to oracles and to get around it, I executed external commands to sqlplus and just parsed through the output to get my data. It's a hacky work around sure, but it gets the job done. Of course getting the module to work is the best course of action. I'm merely providing a quick fix here. | [reply] |
Re: Perl Module for Oracle DB Connection?
by afoken (Chancellor) on Mar 31, 2011 at 09:45 UTC
|
| [reply] |