Perl connection to an SQL server database

I am just getting started with this connection to pull data out of the sql server database:

use strict;
use DBI;

my $dbh = DBI->connect('dbi:Oracle:db_name','username','password',{RaiseError=>1, AutoCommit=>0 }) || die "Database connection not made: $DBI:errstr";
 I do have a DBI directory under \Perl\lib but get this error:
Global symbol "$DBI" requires explicit package name at line 6.

Execution of aborted due to compilation errors.

What am I missing?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kkbenjAuthor Commented:
That code was my first attempt at connecting to Oracle.  Need to connect to both, although my question right now concerns SQL Server
I believe the issue is that your die statement has $DBI:errstr - it should be $DBI::errstr (two colons).
Try this:

die "Database connection not made:" . $DBI->errstr";

you need to terminate the "Database connection not made" string and insert  a dot to append the $DBI->errstr  dot between the string and the output from DBI->errstr,  Also note  the syntax is DBI->errstr not DBI:errstr
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

kkbenjAuthor Commented:
darling39 - I tried this but still get the Global symbol "$DBI" requires explicit package name
darling39 is incorrect.  It should be $DBI::errstr (with two colons).  After it is connected, it should be $dbh->errstr (or some other appropriate handle $var).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kkbenjAuthor Commented:
wilcoxon - I changed to 2 colons.  Thank you for explaining the difference.

Now I get a perl.exe pop up error:
This application has failed to start because OCI.dll was not found.  Re-installing the application may fix this problem.

Shouldn't any connection failure be caught in die?
Normally, yes.  However, that popup is a Windows system error which I don't think can be caught at the application level.  You are missing OCI.dll - a Google search ( pulls up some promising looking pages (a free download, wikipedia entry, several questions (and hopefully answers) about missing oci.dll, etc).
kkbenjAuthor Commented:
Thanks for all of your help and patience.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.