Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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=;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"); }

Replies are listed 'Best First'.
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=;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:

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://783019]
[choroba]: ah, these

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2018-06-19 12:46 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.