Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle-centric tutorial recommendation

Status
Not open for further replies.

Thargy

Technical User
Nov 15, 2005
1,348
GB
folks,

I am determined to learn PERL as my scripting language for Oracle (I am an Oracle DBA who's pig sick of struggling with decrepit tools).

I have downloaded ActiveState perl, and can say "Hello World" etc. However, to be meaningful for me, I must be able to connect to an oracle database, and start issuing DML and DDL statements successfully.

I have found the online book "Teach yourself perl 5 in 21 days" by David Till, but this appears to make no mention of connecting to relational databases of any sort.

Amazon has several books on PERL, but I am unable to find something which will definitely show me how to connect to Oracle, and then enable me to crack on with useful work.

Could someone please recommend an appropriate on-line tutorial (preferred) or an authoritative book with specific examples relating to connecting to Oracle?

Regards

Tharg

Grinding away at things Oracular
 
well.. if you just read the docs on DBI and DBD::Oracle they should help you out.. I personally have the learn perl in 21 days but didn't like the book. You can get the CD Bookshelf (has like 7 books in it) pretty cheap if you don't mind reading off the computer screen.

Here is something to get you started though (it's on unix so you I'm sure you will have to tweak for windows) and I haven't tested this at all I just cut chunks out of some other code

Code:
$ENV{'ORACLE_HOME'} = '/oracle/product/9.2.0.1.0';


use DBI;

$dbh = DBI->connect('DBI:Oracle:host=oraclehost;sid=oraclesid', 'oraclelogin', 'oraclepassword')|| die "Can't connect to DB: $DBI::errstr\n";
$dbh->{LongReadLen} = 65535;
$sth=$dbh->prepare($query);
$sth->execute;
while (@temp = $sth->fetchrow_array){
	print @temp;
}
$sth->finish;
$dbh->disconnect();

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top