David, I read them and installed 4.1.10 and I am back to square one:
I used the following code: #!/perl use warnings; use strict; use DBI; #use DBD-mysql; my $group_name = "beer"; my $me = "E"; my $daily = "03032005"; my $item = "Bacardi"; my $unit = "2"; my $qty = "3"; my $amount = "6"; my $tax = "0.41"; my $total = "6.41"; my $dbh=DBI->connect( 'dbi:mysql:club', 'gjwpp88', 'xxxxxxxxx' ) or die "\n$DBI::errstr\n"; my $sql = "insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?, ?, ?, ?, ?, ? ) "; my $sth = $dbh->prepare( $sql ) or die $dbh->errstr if $dbh->err; $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn "Cannot execute FIRST Statement!!\n$DBI::errstr"; I get "DBI connect<'club','gjwpp88',..> failed; Client does not support authentication protocol requested by server" I have done the following with no errors! GRANT ALL PRIVILEGES ON club.* TO 'gjwpp88'@'local_host'; SET PASSWORD FOR 'gjwpp88'@'local_host' = PASSWORD('xxxxxxxxx'); UPDATE mysql.user SET Password = OLD_PASSWORD('xxxxxxxxx') WHERE Host = 'local_host' AND User = 'gjwpp88'; SET PASSWORD FOR 'gjwpp88'@'local_host' = OLD_PASSWORD('xxxxxxxxx'); SELECT 'local_host', 'gjwpp88', Password FROM mysql.user WHERE LENGTH('xxxxxxxxx') > 16; FLUSH PRIVILEGES; I am still getting the same error I listed above. Jerry -----Original Message----- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 6:10 PM To: Gerald Preston; mysql@lists.mysql.com Subject: RE: insert data Hi Gerald, There are some good tutorials on the web for DBI access via perl to mysql. http://www.wbluhm.com/MySQLTut.html http://perl.about.com/od/installandusemysql/l/aa090803b.htm http://dev.mysql.com/doc/mysql/en/perl.html and also http://search.cpan.org/~timb/DBI-1.47/DBI.pm You should be able to find several examples of exactly what you are trying to achieve in one of these. The first one has an almost identical query to that you are trying to achieve. If you can't select from the table, then you are unlikely to be able to insert. I would follow the tutorials, even if they are selects, and make sure they work and then all you have to do is to change the SELECT to an INSERT statement and away you go. These have a very thorough examination of the setting up of the dsn etc. I would also suggest http://dev.mysql.com/doc/mysql/en/privilege-system.html This gives a good explanation of how the GRANT/REVOKE/privileges system works with MySQL. It is slightly different than Oracle and would be well worth a read. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -----Original Message----- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Tuesday, 1 March 2005 10:10 AM To: 'William R. Mussatto'; mysql@lists.mysql.com Subject: RE: insert data William, I tried " GRANT ALL ON *.* " and got error " 1064 <4200>: You have an error in your SQL syntax " ?? Jerry -----Original Message----- From: William R. Mussatto [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 3:25 PM To: mysql@lists.mysql.com Subject: RE: insert data Gerald Preston said: > Michael, > > This is the actual code except for the "xxxx": > > my $dbh = DBI->connect( 'DBI:mysql:database=club', 'xxxx', 'xxxx', { > PrintError => 0 } ) or die $DBI::errstr; > my $sql = "insert into wolfies( group_name, me, daily, item, unit, > qty, > amount, tax, total ) > values( ?, ?, ?, ?, ?, ?, > ?, > ?, ? ) "; > my $sth = $dbh->prepare( $sql ) or die $dbh->errstr if $dbh->err; > > $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, > $tax, $total ) or warn "Cannot execute FIRST Statement!!\n$DBI::errstr"; > > Question? When I created the database club, is there anything I needed > to do concerning permissions or anything? > > I am lost here. I have been writing code on a SUN Oracle systems for > over five years. > > Regards, > > Jerry Did you 'grant' user "xxxx" access to all the tables in database club? > > -----Original Message----- > From: Michael Stassen [mailto:[EMAIL PROTECTED] > Sent: Monday, February 28, 2005 9:29 AM > To: Gerald Preston > Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com > Subject: Re: insert data > > From perldoc DBD::mysql > > use DBI; > > $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; > > $dbh = DBI->connect($dsn, $user, $password); > > So it's not a syntax problem. Even if it were, we should detect the > error long before calling prepare or execute. > > Perl is quite clearly telling you what is wrong. Originally, you got > > Can't call method "prepare" on an undefined value. > > for the line > > my $sth = $dbh->prepare( $sql ); > > which means that $dbh is undefined at the time of the call to prepare. > > Now, you are getting > > Can't call method "execute" on an un undefined value > > for the line > > $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, > $tax, $total ) or warn "Cannot execute FIRST > Statement!!\n$DBI::errstr"; > > which means that $sth is undefined at the time of the call to execute. > > Are you showing us select lines of your code, rather than the actual > code? My best guess right now is that you haven't taken into account > that "my" is a scoping operator in perl, and in the lines you haven't > showed us, the variables in question ($dbh or $sth) go out of scope. > > Michael > > John Doe wrote: >> Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: >> >> Hi Gerald >> >> >>>The object used: >>> >>> my $dbh=DBI->connect( 'DBI:mysql:database=club', 'xxx, 'xxxxx', { >>>PrintError => 0} ) or die $DBI::errstr; >> >> >> I didn't see this part in your first post :-) >> >> Hmm... I've never seen a '=' in the first argument passed to > DBI-connect... >> >> Here's an functional example I'm using: >> >> my $db ='database'; >> my $host ='hostname'; >> my $port ='1234'; >> $dbh=DBI->connect("DBI:mysql:$db:$host:$port", >> 'a_username', >> 'a_password', >> {RaiseError=>1, >> AutoCommit=>1}) >> or die "$0: $DBI::errstr"; } >> >> >> So, try using "club" instead of "database=club", and a hostname too. >> >> greetings joe >> >> >> [nothing new below] >> >> >>>-----Original Message----- >>>From: John Doe [mailto:[EMAIL PROTECTED] >>>Sent: Sunday, February 27, 2005 6:37 AM >>>To: mysql@lists.mysql.com >>>Subject: Re: insert data >>> >>>Hi Gerald >>> >>> >>>>I am trying to insert data for the first time using MySQL. In Oracle >>>> I used the following: >>>> >>>># my $sql = "insert into bar( group_name, me, daily, item, unit, >>>> qty, amount, tax, total ) >>>> >>>># values( ?, ?, ?, ?, ?, ?, >>>> ?, ?, ? ) "; >>>> my $sth = $dbh->prepare( $sql ); >>>> die $dbh->errstr if $dbh->err; >>>> $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, >>>> $amount, >>>>$tax, $total ) || die "Cannot execute FIRST >>>> Statement!!\n$DBI::errstr"; >>>> >>>> >>>>I keep getting "Can't call method "prepare" on an un undefined value. >>>> All the name listed are correct by looking at MySQLAdmin1.3\4. >>> >>>Apart from David Logan's answer: >>> >>>You have to create the $dbh object first (man DBI); the "undefined >>> value" in >>> >>>the error message refers to that. >>> >>> >>>HTH >>> >>>joe > -- William R. Mussatto, Senior Systems Engineer Ph. 909-920-9154 ext. 27 FAX. 909-608-7061 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]