Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Monks,

Perl newbie here. I have a windows 10 machine, with Strawberry Perl installed (5.32.1 - Jan 2021 release) that apparently comes preloaded with DBI and DBD::Oracle driver. however, I am unable to connect with my local oracle 19c instance that I have on my machine.

I researched some questions and they all seem to point to installing a 32-bit oracle client, that is no longer available to download. Please can you help. Here is my code:

# database connector # load all the libraries use DBI; use warnings; # print("\n\n\tA\n\n"); my @drivers = DBI->available_drivers(); =pod foreach my $driver (@drivers) { print ("$driver \n "); my @dataSources = DBI->data_sources($driver); foreach my $datasource (@dataSources) { print("\t $datasource\n"); } } =cut $dbname = "orcl"; $driver = "oracle"; $host = "localhost"; $username = "meeee"; $password = "000000000000"; $dsn = "dbi:oracle:orcl;host=$host;port=1539"; $dbh = DBI->connect("dbi:oracle:host=localhost;port=1539",$username,$p +assword) or die $DBI::errstr; exit;

and here is the output I received

Name "main::driver" used only once: possible typo at .\ l +ine 21. Name "main::dsn" used only once: possible typo at .\ line +25. Name "main::dbh" used only once: possible typo at .\ line +27. Name "main::dbname" used only once: possible typo at .\ li +ne 20. DBD::oracle initialisation failed: Can't locate object method "driver" + via package "DBD::oracle" at C:/Strawberry/perl/vendor/lib/ li +ne 829. Perhaps the capitalisation of DBD 'oracle' isn't right. at .\dbconnect line 27.


The connection string needs 'Oracle' to be mentioned, along with the datatabse SID in connection string.

Also, there seems to be legacy documentations that suggests installing Oracle Instant Client, Visual C++ distributable and Windows SDK to get Perl/DBD::Oracle interact with a oracle database in windows operating system.

I did not do any of these and yet it worked for me with Strawberry Perl 5.32.1 (Jan 2021). So please consider the environment before moving to installing a bunch of dependencies which one may or may not need/be applicable anymore. I already wasted time and effort attempting to locate legacy drivers and SDKs that was never needed.

In reply to Unable to connect to Oracle 19c by SpaceCowboy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-09-24 16:37 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (114 votes). Check out past polls.