Cannot connect to Oracle

564 views
Skip to first unread message

Will W.

unread,
Jan 25, 2012, 7:33:02 PM1/25/12
to Mojolicious
I am not able to connect to connect to a remote Oracle database from
my Mojolicious::Lite app. Other "normal" perl scripts however can.

I set the relevant $ENV's in a begin block:

BEGIN {
$ENV{SYBASE} = "C:\\Sybase";
$ENV{SYBASE_OCS} = "OCS-15_0";
$ENV{Path} = "C:\\sybase\\OCS-15_0\\bin;C:\\sybase\\OCS-15_0\
\dll;C:\\sybase\\OCS-15_0\\lib3p;H:\\instantclient_11_2;" .
$ENV{Path};
$ENV{ORACLE_HOME} = "H:\\instantclient_11_2";
$ENV{TNS_ADMIN} = "H:\\instantclient_11_2";
}

and as I mentioned earlier, my trivial script (outside of the lite
app) is able to connect and retrieve results just fine.

The error I receive is:

install_driver(Oracle) failed: Can't load 'C:/Perl/lib/auto/DBD/Oracle/
Oracle.dll' for module DBD::Oracle: load_file:The specified module
could not be found at C:/Perl/lib/DynaLoader.pm line 201.
at (eval 4180) line 3
Compilation failed in require at (eval 4180) line 3.
Perhaps a required shared library or dll isn't installed where
expected
at deck.pl line 110

( line 110: my $dbh = DBI->connect(....); )

I can read H: just fine, even from the script, but I wondered if the
fact that the client is there could have introduced an issu so I moved
things under C:.. and now I get this error:

install_driver(Oracle) failed: Attempt to reload DBD/Oracle.pm
aborted.
Compilation failed in require at (eval 4185) line 3.

Any help would be appreciated. I can confirm that $ENV{Path} contains
the path to the oracle client. I can `call` the external script from
Mojo and get results back but don't really want to resort to that.

Could Mojo or morbo be doing something to my environment so that I
can't connect? Any help would be appreciated.

Thanks!

OS: Windows XP
Oracle: instantclient_11_2
Mojo: v1.99

John Scoles

unread,
Jan 25, 2012, 9:22:27 PM1/25/12
to mojol...@googlegroups.com
Definately not a Mojo problem as I use Oracle myself with Morbo.
 
The 
'install_driver(Oracle) failed: Can't load 'C:/Perl/lib/auto/DBD/Oracle/
> Oracle.dll'
 
tells me you do not have DBD::Oracle installed or your perl that Morbo is using is not pointing to the correct perl.
 
So it is not even getting to any mojo code before it fails.
 
The path to the Oracle client does not do anything in this case you have to make sure you perl points to the Oracle.dll
 
Once you get that problem worked out then the client comes into play.
 
Cheers
John
 
 

 
> Date: Wed, 25 Jan 2012 16:33:02 -0800
> Subject: [Mojolicious] Cannot connect to Oracle
> From: will....@gmail.com
> To: mojol...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "Mojolicious" group.
> To post to this group, send email to mojol...@googlegroups.com.
> To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
>

Denis Fedoseev

unread,
Jan 26, 2012, 1:42:10 AM1/26/12
to mojol...@googlegroups.com
It's no Mojo problem.
Check your  installation of DBD:: Oracle and Oracle client.

I use this code to connect:

$ENV{ORACLE_HOME} = '/path/to/your/ocarle-client';
$ENV{NLS_LANG} = 'AMERICAN_AMERICA.AL32UTF8';

use DBI;
use DBD::Oracle qw(:ora_types);

my $dbh = DBI->connect("dbi:oracle:db_name", username, password, { RaiseError => 0, AutoCommit => 0, ora_charset => 'AL32UTF8' });
$dbh->{LongReadLen} = 2*1024*1024;


2012/1/26 John Scoles <byte...@hotmail.com>



--
С уважением, Денис Федосеев

Will W.

unread,
Jan 26, 2012, 11:29:31 AM1/26/12
to Mojolicious
moving the BEGIN block into morbo fixed the issue. Thanks!!

On Jan 25, 8:22 pm, John Scoles <byter...@hotmail.com> wrote:
> Definately not a Mojo problem as I use Oracle myself with Morbo.
>
> The
> 'install_driver(Oracle) failed: Can't load 'C:/Perl/lib/auto/DBD/Oracle/
>
> > Oracle.dll'
>
> tells me you do not have DBD::Oracle installed or your perl that Morbo is using is not pointing to the correct perl.
>
> So it is not even getting to any mojo code before it fails.
>
> The path to the Oracle client does not do anything in this case you have to make sure you perl points to the Oracle.dll
>
> Once you get that problem worked out then the client comes into play.
>
> Cheers
> John
>
>
>
> > Date: Wed, 25 Jan 2012 16:33:02 -0800
> > Subject: [Mojolicious] Cannot connect to Oracle
> > From: will.wil...@gmail.com
> > For more options, visit this group athttp://groups.google.com/group/mojolicious?hl=en.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages