Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 8th, 2000, 09:26 PM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I have tried to run some scrip with "use DBI;" statement. and it produces error "Can't locate DBD/MySql.pm in @INC...."
I need it to connect to MySql.

Could someone please tell me what files do I need and where to put them in my cgi-bin ?

I tried downloading modules from cpan.org, but I get lost.

Reply With Quote
  #2  
Old October 9th, 2000, 03:20 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Start here -> http://www.devshed.com/Talk/Forums/Forum6/HTML/000367.html

Reply With Quote
  #3  
Old October 9th, 2000, 07:38 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
This is error which appears in telnet after running program which has "use DBI;" statement.
I have DBI.pm in same directory as script (cgi-bin) and MySql.pm in cgi-bin/DBD/MySql.pm

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
[upitnik@mighty cgi-bin]$ perl baza.cgi
DBD::MySql initialisation failed: Can't locate object method "driver" via package "DBD::MySql" at /usr/lib/perl5/site_perl/5.005/i386-linux/DBI.pm line 511.

Perhaps the capitalisation of DBD 'MySql' isn't right. at baza.cgi line 7
[upitnik@mighty cgi-bin]$
[/code]

[This message has been edited by Pepe (edited October 09, 2000).]

Reply With Quote
  #4  
Old October 9th, 2000, 07:58 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
As mentioned from my link, you need to have a "use lib" line in addition to your "use DBI;" line. The path of use lib needs to be full server path.

Reply With Quote
  #5  
Old October 9th, 2000, 09:11 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I added that line, but nothing changed.
Beginning of my script look like this:

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
#!/usr/bin/perl

use lib '/home/sites/site337/cgi-bin';

use DBI;

my $dbh = DBI->connect('DBI:MySql:upitniknet', 'upitnik', 'xxxyyy')
or die "Couldn't connect to database: " . DBI->errstr;
my $sth = $dbh->prepare('SELECT * FROM test WHERE lastname = ?')
or die "Couldn't prepare statement: " . $dbh->errstr;
[/code]

I even tried to add:
"use lib '/home/sites/site337/cgi-bin/DBD';"
but it is same.

[This message has been edited by Pepe (edited October 09, 2000).]

Reply With Quote
  #6  
Old October 9th, 2000, 12:45 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>Perhaps the capitalisation of DBD 'MySql' isn't right. at baza.cgi line 7

Have you checked that?

>>my $dbh = DBI->connect('DBI:MySql:upitniknet', 'upitnik', 'xxxyyy')

It should be "mysql", not "MySql".

Reply With Quote
  #7  
Old October 9th, 2000, 01:30 PM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I thought it should be same as file name.
It works now

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > DBI - MySQL instalation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway