in reply to Net::FTPServer MySQL Port

Dear Simon,

It's great. I'll add the sql dump below. I found a little typo in line 154 of

package Project::Net::FTP::DirHandle;

$sql = "select ID, name from directories
should be:
$sql = "select ID, name from DIRECTORIES
because MySQL is case sensitive in it's column names.

To use the sql dump below do as follows:
1. mysql -p -uroot -e "create database ftpdb"
2. mysql -uroot -p -e "grant all privileges on ftpdb.* to rich@localhost identified by '123456'"
3. mysql -p -uroot -e "flush privileges"
4. save the text below from "--MySQL dump 9.10" to the bottom as example.sql
5. mysql -v -p123456 -urich ftpdb < example.sql
6. change line 40-43 in package Project::Net::FTP::Server; from:

my $dbh = DBI->connect ("dbi:mysql(RaiseError=>1,AutoCommit=>1):dbname=TEST",
"username", "password")
or die "cannot connect to database: ftp: $!";

into:

my $dbh = DBI->connect ("dbi:mysql(RaiseError=>1,AutoCommit=>1):dbname=ftpdb",
"rich", "123456")
or die "cannot connect to database: ftp: $!";

Kind regards,
Arjan Widlak

-- MySQL dump 9.10 -- -- Host: localhost Database: ftpdb -- ------------------------------------------------------ -- Server version 4.0.18 -- -- Table structure for table `DIRECTORIES` -- CREATE TABLE DIRECTORIES ( ID int(11) NOT NULL default '0', parent_ID int(11) default NULL, name text NOT NULL, PRIMARY KEY (ID) ) TYPE=MyISAM; -- -- Dumping data for table `DIRECTORIES` -- INSERT INTO DIRECTORIES VALUES (1,0,''); INSERT INTO DIRECTORIES VALUES (2,1,'Home'); INSERT INTO DIRECTORIES VALUES (3,1,'Website'); INSERT INTO DIRECTORIES VALUES (4,1,'Private'); INSERT INTO DIRECTORIES VALUES (5,1,'Test'); -- -- Table structure for table `FILES` -- CREATE TABLE FILES ( ID int(11) NOT NULL default '0', directory_ID int(11) default NULL, name text NOT NULL, data blob, PRIMARY KEY (ID) ) TYPE=MyISAM; -- -- Dumping data for table `FILES` -- -- -- Table structure for table `USERS` -- CREATE TABLE USERS ( id int(11) NOT NULL auto_increment, username text NOT NULL, password text, PRIMARY KEY (id) ) TYPE=MyISAM; -- -- Dumping data for table `USERS` -- INSERT INTO USERS VALUES (1,'rich','MpU8yRWrKoWKc'); INSERT INTO USERS VALUES (2,'dan','MpU8yRWrKoWKc');
  • Comment on It's GREAT! Re: Net::FTPServer MySQL Port