GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  Perl
Go To First  |  Previous Question  |  Next Question 
 Perl  |  Question 17 of 61    Print  
how do you connect to database in perl

  
Total Answers and Comments: 3 Last Update: May 20, 2006     Asked by: suseel 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 17, 2006 16:49:07   #1  
Manjusha1 Member Since: May 2006   Contribution: 5    

RE: how do you connect to database in perl
There is DBI module.use DBI;my $dbh DBI->connect('dbi:Oracle:orcl' 'username' 'password' )where username and password is yours. THis is exmaple for oracle database.Hope this helps Manjusha
 
Is this answer useful? Yes | No
May 18, 2006 11:53:11   #2  
suseel        

RE: how do you connect to database in perl

Helo Manjusha

I have used the same code you have given but it is giving error like this :

Program is :

use DBI; # Load the DBI module

### Perform the connection using the Oracle driver
$dbh DBI->connect( dbi:Oracle:orcl scott
tiger )
or die Can't connect to Oracle database: $DBI::errstr\n ;

exit;

Error is :

install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains
: C:/Perl/lib C:/Perl/site/lib .) at (eval 4) line 3.
Perhaps the DBD::Oracle perl module hasn't been fully installed
or perhaps the capitalisation of 'Oracle' isn't right.
Available drivers: DBM ExampleP File Proxy Sponge.
at D:\perl programs\db.pl line 7


 
Is this answer useful? Yes | No
May 20, 2006 18:23:06   #3  
max1x Member Since: May 2006   Contribution: 11    

RE: how do you connect to database in perl

You to install the appropriate driver for DB so that the connection can be make just like ODBC drivers for each DB interface are needed...


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape