Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Remote Oracle database access from windows

by tokpela (Chaplain)
on Jul 24, 2009 at 15:36 UTC ( #783019=note: print w/ replies, xml ) Need Help??


in reply to Remote Oracle database access from windows

I use Oracle remotely from Windows all of the time. I don't use ODBC anymore and just connect directly using the Oracle client libraries.

  1. Install and configure Oracle client on Windows
  2. Install ActivePerl
  3. Install DBI module
  4. Install DBD::Oracle module

If you are having trouble connecting, you might have to rename the oci.dll that is installed when installing DBD::Oracle in the Perl bin directory. I have had conflicts with previously installed clients before and having this oci.dll and the Oracle client both installed caused an issue.

Use the following connection string syntax in the DBI connection:

my $dsn = 'dbi:Oracle:host=10.1.1.100;sid=XX;port=1521';

I also use an eval to trap any errors when trying to connect to the database

my $dbh; eval { $dbh = DBI->connect( $dsn, $username, $password) || die "Cannot connect to database - [$dsn]: $DBI::errstr"; }; if ($@) { log("[Error] COULD NOT CONNECT TO DATABASE: [$@]\n"); }


Comment on Re: Remote Oracle database access from windows
Select or Download Code
Re^2: Remote Oracle database access from windows
by my600080 (Novice) on Jul 24, 2009 at 19:54 UTC
    I'm using DBD::ODBC module. When I execute my connecting string, I kept getting this error:
    Data source name not found and no default driver specified.

    I tried to use the DBD::ODBC's connecting without DSN:
    my $DSN = 'driver={Oracle ODBC Driver};Server=10.2.3.0:1521;database=ORADB;uid=oraadmin;pwd=oraadminpassword;';
    my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n";

    But the same error message occurs. I think I might have put the wrong driver= because I cannot find an example for oracle database so I just used the syntax for mysql:
    http://search.cpan.org/~mjevans/DBD-ODBC-1.22/FAQ#How_do_I_connect_without_DSN

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://783019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-04-23 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (541 votes), past polls