|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
Start here -> http://www.devshed.com/Talk/Forums/Forum6/HTML/000367.html
|
|
#3
|
|||
|
|||
|
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).] |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
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).] |
|
#6
|
|||
|
|||
|
>>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". |
|
#7
|
|||
|
|||
|
I thought it should be same as file name.
It works now ![]() Thanks |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > DBI - MySQL instalation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|