Last active
May 11, 2016 12:54
-
-
Save fibo/5901819 to your computer and use it in GitHub Desktop.
Test Oracle connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Gist](https://gist.github.com/fibo/5901819) | |
# | |
## How to launch | |
# $ prove oracle.t | |
use strict; | |
use warnings; | |
use DBI; | |
use File::Spec; | |
use Test::More; | |
my $user = 'scott'; # Change me | |
my $pass = 'tiger'; # Change me | |
my $conn = 'DBI:Oracle:testdb'; # Change me | |
ok $ENV{ORACLE_BASE}, '$ORACLE_BASE env var is defined'; | |
ok $ENV{ORACLE_HOME}, '$ORACLE_HOME env var is defined'; | |
ok $ENV{TNS_ADMIN}, '$TNS_ADMIN env var is defined'; | |
ok -d $ENV{ORACLE_BASE}, '$ORACLE_BASE dir exists'; | |
ok -d $ENV{ORACLE_HOME}, '$ORACLE_HOME dir exists'; | |
ok -e File::Spec->catfile($ENV{TNS_ADMIN}, 'tnsnames.ora'), 'tnsnames.ora exists'; | |
ok my $dbh = DBI->connect($conn, $user, $pass,{ PrintError => 1, }), 'database connection'; | |
done_testing | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment