. /etc/profile && setup oracle
/usr/local/bin/perl -MCPAN -e shell LIB=~/perl PREFIX=~/perlYou will be asked several questions, related to setting up the CPAN build environment. Make sure to specify PREFIX="~/perl" when prompted to do so (a question will be asked about options that are to be passed, and one of them will have a sample PREFIX= variable).
export \ PERL5LIB="/home/username/perl/lib/site_perl/5.8.2/sun4-solaris/"where username, of course is your own username.
Make sure to only use the /usr/local/bin/perl interpreter on Solaris machines.
To allow the interpreter to see the newly installed libraries, add these
statements right after the #!/usr/local/bin/perl line to your Perl scripts:
use lib qw(/home/username/perl/lib/site_perl/5.8.2/sun4-solaris);
use lib qw(/home/username/perl/lib/sun4-solaris/);
use DBI;
use DBD::Oracle;
Where again, username is your own useraname.
To connect to the database, use these statements:
my ($db_username) = "username";
my ($db_password) = "password";
my ($db_host) = "server9.engr.scu.edu";
my ($db_sid) = "dc81";
$dbh = DBI->connect("dbi:Oracle:host=$db_host;sid=$db_sid",
$db_username, $db_password,
{RaiseError => 1, AutoCommit => 1});
(Leave db_host and db_sid as is, but make sure to change db_username and
db_password to reflect the settings for your own Oracle account). Use of
DBI itself is beyond the scope of this document, but documentation should
be readily available at google.
O'Reilly Publishing's Perl Cookbook also contains several excellent DBI
examples.
Back to Aleksandr Feinberg's homepage.
This page is created with vi
The content of these web pages is not generated by and does not represent the views of Santa Clara University or any of its departments or organizations.