Solved

Connectivity of Perl to Oracle

Posted on 2002-05-12
1
216 Views
Last Modified: 2013-12-25
How will I connect my Oracle database to Perl?How will I run the said database with perl?Can I have an sample code for this?
0
Comment
Question by:keziah0815
1 Comment
 
LVL 6

Accepted Solution

by:
andreif earned 100 total points
ID: 7005920
Hi,
here are some parts of my working code, hope it helps

use DBI;
$dbh = DBI->connect("DBI:Oracle:host=DB_IP_HERE;sid=ORCL;port=1521",'DB_USER_NAME_HERE','DB_PASSWORD_HERE') or die "Couldn't connect to database: ".$DBI::errstr;

$sql = "select * from mytable";
$sth=$dbh->prepare($sql) or print DBI::error;
$sth->execute or print $DBI::error;

while ($record = $sth->fetchrow_hashref) {
  print "$$record{name} - $$record{email}<br>";
}
$sth->finish;
$dbh->disconnect;
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question