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  
Old 08-16-2007, 04:58 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 385
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
  #2  
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 Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
TF31003 when connecting to TFS 2008 over the internet bluesky Server Management 1 05-18-2009 04:01 AM
controlling whether gps is connecting or not cenbek03 J2ME 0 10-29-2008 08:20 AM
Connecting Database using Javascript oxygen HTML, CSS and Javascript Coding Techniques 2 02-04-2008 12:17 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 06:23 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0