IT Community - Software Programming, Web Development and Technical Support

Connecting Database using PERL

This is a discussion on Connecting Database using PERL within the Perl forums, part of the Software Development category; Hi, Can someone tell me how to connect MYSQL and ORACLE Databases using PERL?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Perl

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-16-2007, 04:58 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Connecting Database using PERL

Hi,

Can someone tell me how to connect MYSQL and ORACLE Databases using PERL?
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-16-2007, 11:08 PM
raj raj is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
raj is on a distinguished road
Smile Connecting Database using PERL

hi murali,

MySql: (its very similar to php mysql function)

//#-- Connection
$db = Mysql->connect($host, $database, $user, $password);

link for your ref:
Perl and MySQL - Connect MySQL with Perl


Oracle:

#!/opt/products/bin//perl
# This path may be different, it is platform dependent.
#

use DBI;
#---------------------------------------------------------------------------
#-- change user name, password, table name, column names
#---------------------------------------------------------------------------
$dbname = 'dbi:Oracle:desy';
$dbuser = 'scott';
$pass = 'tiger';
$table = 'emp';
$columns = 'empno,ename';
#
#---------------------------------------------------------------------------
#
# connect to the database
$dbh = DBI->connect($dbname, $dbuser, $pass) or die "Cant connect to : $DBI::errstr\n";
# select entries in the database
$sth = $dbh->prepare(qq{select $columns from $table});
# execute the select statement
$sth->execute;
while (@row = $sth->fetchrow_array)
{
print "@row\n";
}
# end the reading of results
$sth->finish;
# disconnect from the database
$dbh->disconnect;
# that's all
exit;

link for your ref:

Oracle interfaces, Perl DBI

TSG: Using Oracle from Perl
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting Database using Javascript oxygen HTML, CSS and Javascript Coding Techniques 2 02-04-2008 12:17 AM
types of object while connecting with mysql venkatbi PHP Programming 0 11-22-2007 04:51 AM
Any idea about Connecting Windows Mobile to Wireless HID devices? itbarota Windows Mobile 0 07-23-2007 06:12 AM
How to set Perl Interpreter within perl script sivaramakrishnan Perl 1 07-19-2007 05:45 AM
connecting database nssukumar Flash Actionscript Programming 1 04-24-2007 10:14 PM


All times are GMT -7. The time now is 12:49 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0