insert data

2005-02-27 Thread Gerald Preston
Hi!

 

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.

 

Any ideas?

 

Thanks,

 

Jerry



RE: insert data

2005-02-27 Thread Gerald Preston
David,

The actual code is uncommented:

my $sql = "insert into bar( group_name, me, daily, item, unit, qty, amount,
tax, total )
values( ?,  ?,  ?, ?,?,?,   ?,  ?,   ? ) ";

Sorry, 
Jerry

-Original Message-
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 5:09 AM
To: Gerald Preston; mysql users
Subject: RE: insert data 

Hi Gerald,

If  this is copied out of your perl code then you haven't put anything
into the $sql variable. Try uncommenting the 2 lines above.

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: Sunday, 27 February 2005 9:33 PM
To: mysql users
Subject: insert data 

Hi!

 

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.

 

Any ideas?

 

Thanks,

 

Jerry


-- 
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]



RE: insert data

2005-02-27 Thread Gerald Preston
I just created a new table with the following:

CREATE TABLE `wolfies` (
`group_name` VARCHAR( 38 ) NOT NULL,
`me` VARCHAR(  3 ) NOT NULL,
`daily`  VARCHAR(  8 ) NOT NULL,
`item`   VARCHAR( 60 ) NOT NULL,
`unit`   VARCHAR( 38 ) NOT NULL,
`qty`int   NOT NULL,
`amount` decimal(8,2) NOT NULL,
`tax`decimal(8,2) NOT NULL,
`total`  decimal(8,2) NOT NULL
);

And get the same "Can't call method "prepare" on an un undefined value".
All the name listed are correct by looking at MySQLAdmin1.4.

my $sql = "insert into wolfies ( group_name, me, daily, item, unit, qty,
amount,
tax, total )
values( ?,  ?,  ?, ?,?,?,   ?,  ?,   ? ) ";
  my $sth = $dbh->prepare( $sql );

  die $dbh->errstr if $dbh->err;

What am I ding wrong?

Thanks,

Jerry

---Original Message-
From: Gerald Preston [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 5:13 AM
To: 'Logan, David (SST - Adelaide)'; 'mysql users'
Subject: RE: insert data 

David,

The actual code is uncommented:

my $sql = "insert into bar( group_name, me, daily, item, unit, qty, amount,
tax, total )
values( ?,  ?,  ?, ?,?,?,   ?,  ?,   ? ) ";

Sorry, 
Jerry

-Original Message-
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 5:09 AM
To: Gerald Preston; mysql users
Subject: RE: insert data 

Hi Gerald,

If  this is copied out of your perl code then you haven't put anything
into the $sql variable. Try uncommenting the 2 lines above.

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: Sunday, 27 February 2005 9:33 PM
To: mysql users
Subject: insert data 

Hi!

 

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.

 

Any ideas?

 

Thanks,

 

Jerry


-- 
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]



RE: insert data

2005-02-27 Thread Gerald Preston
David,

Still the same error!.

Jerry

-Original Message-
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 5:49 AM
To: Gerald Preston; mysql users
Subject: RE: insert data 

Hi Gerald,

Try something like

my $sth = $dbh->prepare("insert into
bar(group_name,me,daily,item,unit,qty,amount,tax,total)
values(?,?,?,?,?,?,?,?,?)");
$sth->execute($group_name,$me,$daily,$item,$unit,$qty,$amount,$tax,$tota
l) 
  || die "Cannot execute FIRST Statement!!\n$DBI::errstr";

That is exactly the same format as I have running in a number of
scripts. You can check out the documentation at
http://search.cpan.org/~timb/DBI-1.47/DBI.pm

This has tons of info on how to use the various methods/properties that
are available with the DBI interface. I also use an O'Reilly book
"Programming the DBI Interface" (I don't have it here so can't refer to
the author, I think it is Tim Bunce)

If you still have a problem, check your column names etc. to ensure they
are correct. I'll have another check tomorrow when I get to work

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: Sunday, 27 February 2005 9:43 PM
To: Logan, David (SST - Adelaide); 'mysql users'
Subject: RE: insert data 

David,

The actual code is uncommented:

my $sql = "insert into bar( group_name, me, daily, item, unit, qty,
amount,
tax, total )
values( ?,  ?,  ?, ?,?,?,   ?,  ?,   ? )
";

Sorry, 
Jerry

-Original Message-
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 5:09 AM
To: Gerald Preston; mysql users
Subject: RE: insert data 

Hi Gerald,

If  this is copied out of your perl code then you haven't put anything
into the $sql variable. Try uncommenting the 2 lines above.

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: Sunday, 27 February 2005 9:33 PM
To: mysql users
Subject: insert data 

Hi!

 

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.

 

Any ideas?

 

Thanks,

 

Jerry


-- 
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]



RE: insert data

2005-02-27 Thread Gerald Preston
The object used:

  my $dbh=DBI->connect( 'DBI:mysql:database=club', 'xxx, 'x', {
PrintError => 0} ) or die $DBI::errstr;

Jerry

-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

-- 
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]



RE: insert data

2005-02-27 Thread Gerald Preston
David,

I just cannot believe what a pain this is.  I got past the prepare with no
errors by doing the following:

  my $dbh = DBI->connect( 'DBI:mysql:database=club', 'xxx', 'xxx', {
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";

I just do not believe this, but I get the same error (almost ):

"Can't call method "execute" on an un undefined value"

Jerry

-Original Message-
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 3:27 PM
To: Gerald Preston; mysql@lists.mysql.com
Subject: RE: insert data

Hi Gerald,

The only thing I can think of is that you have a syntax error in your
SQL that hasn't showed up in translation to email. Are you able to
select from the database prior to the INSERT? This would confirm that
your db has made a successful connection.

The placeholders etc. work exactly as they do in the oracle version of
the DBI.

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: Monday, 28 February 2005 7:49 AM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: RE: insert data

The object used:

  my $dbh=DBI->connect( 'DBI:mysql:database=club', 'xxx, 'x', {
PrintError => 0} ) or die $DBI::errstr;

Jerry

-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

-- 
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]



RE: insert data

2005-02-28 Thread Gerald Preston
Michael,

This is the actual code except for the "":

  my $dbh = DBI->connect( 'DBI:mysql:database=club', '', '', {
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


-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, 'x', {
>>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

-- 
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]



RE: insert data

2005-02-28 Thread Gerald Preston
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 "":
>
>   my $dbh = DBI->connect( 'DBI:mysql:database=club', '', '', {
> 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 "" 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, 'x', {
>>>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]



RE: insert data

2005-03-04 Thread Gerald Preston
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', 'x' ) 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('x');

UPDATE mysql.user SET Password = OLD_PASSWORD('x')
WHERE Host = 'local_host' AND User = 'gjwpp88';

SET PASSWORD FOR 'gjwpp88'@'local_host' = OLD_PASSWORD('x');

SELECT 'local_host', 'gjwpp88', Password FROM mysql.user
WHERE LENGTH('x') > 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 "":
>
>   my $dbh = DBI->connect( 'DBI:mysql:database=club', '', '', {
> 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 "" access to all the tables in database club?
>
> -Original Message-
> From: Michael Stassen [mailto:[EMAIL PROTECTED]
> S

RE: insert data

2005-03-05 Thread Gerald Preston
Michael, John, ALL;

Thank you! Thanks you! My errors of "local_host" and "if $dbh->err" fix it.
I am able to insert and select data.

Thank you ALL,

Jerry

-Original Message-
From: Michael Stassen [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 5:41 PM
To: John Trammell
Cc: mysql@lists.mysql.com; [EMAIL PROTECTED]; Gerald Preston
Subject: Re: insert data

Right.  First, I think the logic is flawed.  We should successfully 
prepare() or die.  Period.  If the call to prepare() failed ($sth is undef),

we should not making dying conditional on yet another value.

More to the point, this line is actually the cause of the problem.  (Sorry I

didn't see it earlier.)  You've run into the precedence rules:

   my $sth = $dbh->prepare( $sql ) or die $dbh->errstr if $dbh->err;

is read as

   (my $sth = $dbh->prepare( $sql ) or die $dbh->errstr) if $dbh->err;

That is, it is equivalent to

   if ($dbh->err)
   {
 $sth = $dbh->prepare( $sql ) or die $dbh->errstr;
   }

Since the connect succeeded, $dbh->err is undef, so we never even call 
prepare!  Hence, $sth is undef when we get to execute, and you get the error

message.  I expect this is what Joe (John Doe) was trying to tell us
earlier.

The simplest solution would be to drop the "if $dbh->err".  That is, change
to

   my $sth = $dbh->prepare( $sql ) or die $dbh->errstr;

John's suggestion (below) is better still, as it adds helpful detail to the 
error message when there is one (though I don't see the need to make it a 
separate line of code).

Michael


John Trammell wrote:

> Gerald Preston wrote:
> [snip]
> 
>>my $sth = $dbh->prepare( $sql ) or die $dbh->errstr if $dbh->err;
> 
> [snip]
> 
> Regardless of other problems you may be having, I think you're not
> doing what you want to do here.  How about instead:
> 
> my $sth = $dbh->prepare($sql);
> $sth || die "Error preparing sth from '$sql': ", $dbh->errstr;
> 

-- 
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]



insert was working

2005-03-17 Thread Gerald Preston
Hi!

 

I was able to insert data with the following:

 

sub insert_sql {

 

  my ( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total,
$DEBUG ) = @_;

 

  print "[EMAIL PROTECTED]" if $DEBUG;

  ( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) =
&clean_sql( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax,
$total, $DEBUG );

  print "\ninsert_sql -
*$group_name*$me*$daily*$item*$unit*$qty*$amount*$tax*$total*\n" if $DEBUG;

  my $dbh = DBI->connect( "DBI:mysql:club","gjwpp88","password" ) || 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 ) || die $dbh->errstr;

  $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount,
$tax, $total ) || die "Cannot execute insert_sql!!\n$DBI::errstr";

}1;

 

I am no longer able to insert any data at all.  No errors, nothing.  It acts
like it works. But I am able to select existing data with the following:

 

sub select_sql {

 

  my ( $me, $daily, $DEBUG ) = @_;

  my %data = ();

  

  print "[EMAIL PROTECTED]" if $DEBUG;

  $me =~ s/\s+//;

  $daily  =~ s/\s+//;

  my $dbh = DBI->connect( "DBI:mysql:club","gjwpp88","password" ) or die
"\n$DBI::errstr\n";

  my $sql = "select group_name, me, daily, item, unit, qty, amount, tax,
total 

 from   wolfies 

 where  me= '$me' 

 anddaily = '$daily'

"; 

  print "sql *$sql*\n" if $DEBUG; 

  my $sth = $dbh->prepare( $sql ) || die "$DBI::errstr\n"; 

  my $rv  = $sth->execute() || die "Cannot execute
select_sql!!$DBI::errstr"; 

  while( my ( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax,
$total ) = $sth->fetchrow() ) {

print "\nselect_sql $group_name, $me, $daily, $item, $unit, $qty,
$amount, $tax, $total*\n" if $DEBUG;

push @{ $data{ $group_name }}, "$item, $unit, $qty, $amount, $tax,
$total";

  }

  return \%data;

}1;

 

I have done the following setup options:

 

GRANT ALL PRIVILEGES ON club.* TO 'gjwpp88'@'localhost';

 

SET PASSWORD FOR 'gjwpp88'@'localhost' = PASSWORD('password');

 

UPDATE mysql.user SET Password = OLD_PASSWORD('password')

WHERE Host = 'localhost' AND User = 'gjwpp88';

 

SET PASSWORD FOR 'gjwpp88'@'localhost' = OLD_PASSWORD('password');

 

SELECT 'localhost', 'gjwpp88', Password FROM mysql.user

WHERE LENGTH('password') > 16;

 

 

 

FLUSH PRIVILEGES;

 

Any ideas?

 

Thanks,

 

Jerry



RE: insert was working

2005-03-17 Thread Gerald Preston
Richard, 

Explain auto_increment field please.

Thanks,

Jerry

-Original Message-
From: Richard Whitney [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 17, 2005 10:31 AM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: Re: insert was working

Gerald!

Do you have an auto_increment field?
If so, what's it set as?

Richard

Quoting Gerald Preston <[EMAIL PROTECTED]>:

> Hi!
>
>
>
> I was able to insert data with the following:
>
>
>
> sub insert_sql {
>
>
>
>   my ( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax,
$total,
> $DEBUG ) = @_;
>
>
>
>   print "[EMAIL PROTECTED]" if $DEBUG;
>
>   ( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total )
=
> &clean_sql( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax,
> $total, $DEBUG );
>
>   print "\ninsert_sql -
> *$group_name*$me*$daily*$item*$unit*$qty*$amount*$tax*$total*\n" if
$DEBUG;
>
>   my $dbh = DBI->connect( "DBI:mysql:club","gjwpp88","password" ) || 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 ) || die $dbh->errstr;
>
>   $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount,
> $tax, $total ) || die "Cannot execute insert_sql!!\n$DBI::errstr";
>
> }1;
>
>
>
> I am no longer able to insert any data at all.  No errors, nothing.  It
acts
> like it works. But I am able to select existing data with the following:
>
>
>
> sub select_sql {
>
>
>
>   my ( $me, $daily, $DEBUG ) = @_;
>
>   my %data = ();
>
>
>
>   print "[EMAIL PROTECTED]" if $DEBUG;
>
>   $me =~ s/\s+//;
>
>   $daily  =~ s/\s+//;
>
>   my $dbh = DBI->connect( "DBI:mysql:club","gjwpp88","password" ) or die
> "\n$DBI::errstr\n";
>
>   my $sql = "select group_name, me, daily, item, unit, qty, amount, tax,
> total
>
>  from   wolfies
>
>  where  me= '$me'
>
>  anddaily = '$daily'
>
> ";
>
>   print "sql *$sql*\n" if $DEBUG;
>
>   my $sth = $dbh->prepare( $sql ) || die "$DBI::errstr\n";
>
>   my $rv  = $sth->execute() || die "Cannot execute
> select_sql!!$DBI::errstr";
>
>   while( my ( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax,
> $total ) = $sth->fetchrow() ) {
>
> print "\nselect_sql $group_name, $me, $daily, $item, $unit, $qty,
> $amount, $tax, $total*\n" if $DEBUG;
>
> push @{ $data{ $group_name }}, "$item, $unit, $qty, $amount, $tax,
> $total";
>
>   }
>
>   return \%data;
>
> }1;
>
>
>
> I have done the following setup options:
>
>
>
> GRANT ALL PRIVILEGES ON club.* TO 'gjwpp88'@'localhost';
>
>
>
> SET PASSWORD FOR 'gjwpp88'@'localhost' = PASSWORD('password');
>
>
>
> UPDATE mysql.user SET Password = OLD_PASSWORD('password')
>
> WHERE Host = 'localhost' AND User = 'gjwpp88';
>
>
>
> SET PASSWORD FOR 'gjwpp88'@'localhost' = OLD_PASSWORD('password');
>
>
>
> SELECT 'localhost', 'gjwpp88', Password FROM mysql.user
>
> WHERE LENGTH('password') > 16;
>
>
>
>
>
>
>
> FLUSH PRIVILEGES;
>
>
>
> Any ideas?
>
>
>
> Thanks,
>
>
>
> Jerry
>
>


R. Whitney
Transcend Development
"Producing the next phase of your internet presence"
http://xend.net
Premium Quality Web Hosting
http://xendhosting.com
rw AT xend.net
Net Binder  http://netbinder.net
310-943-6498
602-288-5340


-- 
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]



ppm install problems

2004-12-05 Thread Gerald Preston
I am trying to install ODBC and it does nothing.  I am running version 4.1.7
on XP Pro.

 

PPM hangs when I query Tk as well.  

 

What is going on?

 

Thanks,

 

Jerry



stating service

2004-12-05 Thread Gerald Preston
I just installed 4.7.1 for XP Pro.  I am unable to Start Service.  I do not
find any error files?

 

I get: "Cannot Create Windows Service for MySQL.Error:0"

 

Any ideas?

 

Thanks,

 

Jerry



starting service

2004-12-05 Thread Gerald Preston
I just installed 4.7.1 for XP Pro.  I am unable to Start Service.  I do not
find any error files?

 

I get: "Cannot Create Windows Service for MySQL.Error:0"

 

Any ideas?

 

Thanks,

 

Jerry

 



first time accessing

2005-01-03 Thread Gerald Preston
I am making my first attempt to access MySQL with Perl 

 

#!/perl

use warnings;

use strict;

use dbi;

 

  my $dbh=DBI->connect( 'dbi:MySQL, 'user', 'pass' ) or die "Cannot connect
-> !$DBI::errstr";

 

and I get the following error:

 

Can't connect to data source dbi:MySQL, no data driver specified and DBS_DSN
env var not set

 

Any ideas?

 

 

Thanks,

 

Jerry

 

 



RE: first time accessing

2005-01-06 Thread Gerald Preston
Tom,

I tried the following:

#!/perl
use warnings;
use strict;
use DBI;

#  my $dbh=DBI->connect( 'DBI:mysql:test:GJWPP88', 'Jerry', 'password' ) or
die "Cannot connect -> gjwpp88!!$DBI::errstr";

#Local Host Name  - GJWPP88
#Local User Name  - Jerry

#database under GJWPP88 - mysql and test

my $driver   = "mysql";
my $server   = "GJWPP88";
my $database = "test";
my $url  = "DBI:$driver:$database:$server";
my $user = "Jerry";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;


And I get the following:

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

All I am wanting to do is connect and create a new table.

Any ideas?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 03, 2005 3:52 PM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Try something like this:

use DBI;
 

my $driver   = "mysql";
my $server   = "myhost";
my $database = "mydb";
my $url  = "DBI:$driver:$database:$server";
my $user = "username";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;

Obviously you don't have to make everything a variable, this is just one
possibility.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa


-Original Message-
From: Gerald Preston
Sent: Monday, January 03, 2005 7:40 PM
To: mysql users
Subject: first time accessing

I am making my first attempt to access MySQL with Perl 

 

#!/perl

use warnings;

use strict;

use dbi;

 

  my $dbh=DBI->connect( 'dbi:MySQL, 'user', 'pass' ) or die "Cannot connect
-> !$DBI::errstr";

 

and I get the following error:

 

Can't connect to data source dbi:MySQL, no data driver specified and DBS_DSN
env var not set

 

Any ideas?

 

 

Thanks,

 

Jerry

 

 


-- 
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]



RE: first time accessing

2005-01-06 Thread Gerald Preston
Tom,

I still get access denied.  I just reinstall the latest version yesterday.
What are my options now?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 06, 2005 6:28 AM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

[snip]

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

[/snip]

I would try your connection from a command line ie. 'mysql -u Jerry -h
GJWPP88 -p'.

The problem is now not with your perl, it is your mysql user permissions.
>From your error, I see that mysqld is running on your local machine. In
this
case you should use localhost instead of the actual hostname ie. 'mysql -u
Jerry -h localhost -p' (you can omit the host on this one, it is default).
If this works, you can change the host in your perl script to localhost, and
you should be ready to go.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-Original Message-
From: Gerald Preston
Sent: Thursday, January 06, 2005 5:25 AM
To: 'Tom Crimmins'
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Tom,

I tried the following:

#!/perl
use warnings;
use strict;
use DBI;

#  my $dbh=DBI->connect( 'DBI:mysql:test:GJWPP88', 'Jerry', 'password' ) or
die "Cannot connect -> gjwpp88!!$DBI::errstr";

#Local Host Name  - GJWPP88
#Local User Name  - Jerry

#database under GJWPP88 - mysql and test

my $driver   = "mysql";
my $server   = "GJWPP88";
my $database = "test";
my $url  = "DBI:$driver:$database:$server";
my $user = "Jerry";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;


And I get the following:

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

All I am wanting to do is connect and create a new table.

Any ideas?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins
Sent: Monday, January 03, 2005 3:52 PM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Try something like this:

use DBI;
 

my $driver   = "mysql";
my $server   = "myhost";
my $database = "mydb";
my $url  = "DBI:$driver:$database:$server";
my $user = "username";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;

Obviously you don't have to make everything a variable, this is just one
possibility.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa


-Original Message-
From: Gerald Preston
Sent: Monday, January 03, 2005 7:40 PM
To: mysql users
Subject: first time accessing

I am making my first attempt to access MySQL with Perl 

 

#!/perl

use warnings;

use strict;

use dbi;

 

  my $dbh=DBI->connect( 'dbi:MySQL, 'user', 'pass' ) or die "Cannot connect
-> !$DBI::errstr";

 

and I get the following error:

 

Can't connect to data source dbi:MySQL, no data driver specified and DBS_DSN
env var not set

 

Any ideas?

 

 

Thanks,

 

Jerry



-- 
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]



RE: first time accessing

2005-01-06 Thread Gerald Preston
Tom,

I am still getting access denied when I try ',mysql -u root'.

Jerry

-Original Message-
From: Tom Crimmins [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 06, 2005 11:24 AM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

If you are using a fresh install of mysql, you need to connect with 'mysql
-u root' from the local machine and then configure access for other users
with the GRANT command. See http://dev.mysql.com/doc/mysql/en/GRANT.html.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-Original Message-
From: Gerald Preston [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 06, 2005 3:08 PM
To: 'Tom Crimmins'
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Tom,

I still get access denied.  I just reinstall the latest version yesterday.
What are my options now?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 6:28 AM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

[snip]

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

[/snip]

I would try your connection from a command line ie. 'mysql -u Jerry -h
GJWPP88 -p'.

The problem is now not with your perl, it is your mysql user permissions.
>From your error, I see that mysqld is running on your local machine. In
this
case you should use localhost instead of the actual hostname ie. 'mysql -u
Jerry -h localhost -p' (you can omit the host on this one, it is default).
If this works, you can change the host in your perl script to localhost, and
you should be ready to go.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-Original Message-
From: Gerald Preston
Sent: Thursday, January 06, 2005 5:25 AM
To: 'Tom Crimmins'
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Tom,

I tried the following:

#!/perl
use warnings;
use strict;
use DBI;

#  my $dbh=DBI->connect( 'DBI:mysql:test:GJWPP88', 'Jerry', 'password' ) or
die "Cannot connect -> gjwpp88!!$DBI::errstr";

#Local Host Name  - GJWPP88
#Local User Name  - Jerry

#database under GJWPP88 - mysql and test

my $driver   = "mysql";
my $server   = "GJWPP88";
my $database = "test";
my $url  = "DBI:$driver:$database:$server";
my $user = "Jerry";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;


And I get the following:

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

All I am wanting to do is connect and create a new table.

Any ideas?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins
Sent: Monday, January 03, 2005 3:52 PM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Try something like this:

use DBI;
 

my $driver   = "mysql";
my $server   = "myhost";
my $database = "mydb";
my $url  = "DBI:$driver:$database:$server";
my $user = "username";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;

Obviously you don't have to make everything a variable, this is just one
possibility.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa


-Original Message-
From: Gerald Preston
Sent: Monday, January 03, 2005 7:40 PM
To: mysql users
Subject: first time accessing

I am making my first attempt to access MySQL with Perl 

 

#!/perl

use warnings;

use strict;

use dbi;

 

  my $dbh=DBI->connect( 'dbi:MySQL, 'user', 'pass' ) or die "Cannot connect
-> !$DBI::errstr";

 

and I get the following error:

 

Can't connect to data source dbi:MySQL, no data driver specified and DBS_DSN
env var not set

 

Any ideas?

 

 

Thanks,

 

Jerry



--
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]



RE: first time accessing

2005-01-06 Thread Gerald Preston
Tom,

I am running 'WinMySQLadmin 4.1".  Can I use this tool to change anything?

Jerry

-Original Message-
From: Tom Crimmins [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 06, 2005 11:24 AM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

If you are using a fresh install of mysql, you need to connect with 'mysql
-u root' from the local machine and then configure access for other users
with the GRANT command. See http://dev.mysql.com/doc/mysql/en/GRANT.html.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-Original Message-
From: Gerald Preston [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 06, 2005 3:08 PM
To: 'Tom Crimmins'
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Tom,

I still get access denied.  I just reinstall the latest version yesterday.
What are my options now?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 6:28 AM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

[snip]

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

[/snip]

I would try your connection from a command line ie. 'mysql -u Jerry -h
GJWPP88 -p'.

The problem is now not with your perl, it is your mysql user permissions.
>From your error, I see that mysqld is running on your local machine. In
this
case you should use localhost instead of the actual hostname ie. 'mysql -u
Jerry -h localhost -p' (you can omit the host on this one, it is default).
If this works, you can change the host in your perl script to localhost, and
you should be ready to go.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-Original Message-
From: Gerald Preston
Sent: Thursday, January 06, 2005 5:25 AM
To: 'Tom Crimmins'
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Tom,

I tried the following:

#!/perl
use warnings;
use strict;
use DBI;

#  my $dbh=DBI->connect( 'DBI:mysql:test:GJWPP88', 'Jerry', 'password' ) or
die "Cannot connect -> gjwpp88!!$DBI::errstr";

#Local Host Name  - GJWPP88
#Local User Name  - Jerry

#database under GJWPP88 - mysql and test

my $driver   = "mysql";
my $server   = "GJWPP88";
my $database = "test";
my $url  = "DBI:$driver:$database:$server";
my $user = "Jerry";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;


And I get the following:

DBI connect<'test:GJWPP88','Jerry'>  failed: Access denied for user
'Jerry'@'gjwpp88'  at line 17

All I am wanting to do is connect and create a new table.

Any ideas?

Thanks,

Jerry

-Original Message-
From: Tom Crimmins
Sent: Monday, January 03, 2005 3:52 PM
To: Gerald Preston
Cc: mysql@lists.mysql.com
Subject: RE: first time accessing

Try something like this:

use DBI;
 

my $driver   = "mysql";
my $server   = "myhost";
my $database = "mydb";
my $url  = "DBI:$driver:$database:$server";
my $user = "username";
my $pass = "password";
 

my $dbh = DBI->connect($url, $user, $pass)
|| die "Couldn't connect to database: " . DBI->errstr;

Obviously you don't have to make everything a variable, this is just one
possibility.

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa


-Original Message-
From: Gerald Preston
Sent: Monday, January 03, 2005 7:40 PM
To: mysql users
Subject: first time accessing

I am making my first attempt to access MySQL with Perl 

 

#!/perl

use warnings;

use strict;

use dbi;

 

  my $dbh=DBI->connect( 'dbi:MySQL, 'user', 'pass' ) or die "Cannot connect
-> !$DBI::errstr";

 

and I get the following error:

 

Can't connect to data source dbi:MySQL, no data driver specified and DBS_DSN
env var not set

 

Any ideas?

 

 

Thanks,

 

Jerry



--
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]



creating first table

2005-01-06 Thread Gerald Preston
Hi!

 

Running mysql on a XP command line.  Doing "dhow" databases" list the
following;

 

Database

 

Club

Mysql

Test

 

I did a grant all user id;

 

How can I list the rows and columns.

 

I tried "alter table club add < ME varchar( 3));" and get :

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right sysntax to use near 'gjwpp88 club
add (ME varchar( 3 ))  an line 1;



 

What have I missed?

 

Thanks, 

 

Jerry

 

 

 



MySQL & Perl

2005-01-14 Thread Gerald Preston
I am trying to get Perl to talk to MySQL that I have setup.  According to
"WinMySQLAdmin1.4"

 

Local Host Name = GJW

 

Local User name = Jerry

 

Databases:

 

GJW

   Club

  bar

   mysql

   test

 

I am using the following code:

 

#!/perl

use warnings;

use strict;

use DBI;

 

  my $dbh=DBI->connect( 'DBI:mysql:GJW:club:bar', 'gjw', 'password' ) or die
"Cannot connect -> gjw!!$DBI::errstr";

 

What am I missing?

 

Thanks,

 

Jerry



RE: MySQL & Perl

2005-01-22 Thread Gerald Preston
Hi!

I am totally lost here and I know this is a no brinier.  I do not know what
I am doing wrong:

I can access from the command line by "mysql -u gjw -p" then "use club" and
I can do anything I want.

I am trying to access by Perl:

# line 6 following
my $dbh=DBI->connect( 'DBI:mysql:gjw:club', 'gjw', 'password' ) or die
"$DBI::errstr\n";

I get the following error: "DBI connect<'gjw:club','gjw'...> failed: Unknown
MySQL server Host 'club' <11001> at line 6";

How do I find out my server HOST name is?  What else is wrong?

I have done this many times working with Oracle and never had this problem!

Thanks,

Jerry

-Original Message-
From: Gerald Preston [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 14, 2005 12:56 AM
To: mysql@lists.mysql.com
Subject: MySQL & Perl

I am trying to get Perl to talk to MySQL that I have setup.  According to
"WinMySQLAdmin1.4"

 

Local Host Name = GJW

 

Local User name = Jerry

 

Databases:

 

GJW

   Club

  bar

   mysql

   test

 

I am using the following code:

 

#!/perl

use warnings;

use strict;

use DBI;

 

  my $dbh=DBI->connect( 'DBI:mysql:GJW:club:bar', 'gjw', 'password' ) or die
"Cannot connect -> gjw!!$DBI::errstr";

 

What am I missing?

 

Thanks,

 

Jerry




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



first dbi access with perl and lost

2002-09-22 Thread Gerald Preston

Hi!,

I am lost!  I am running in win 98 and my perl code is:

#!perl

  use strict;
  use DBI();

  # Connect to the database.
  my $dbh = DBI->connect("DBI:mysql:database=club;host=localhost",
   "jwp", "x",
 {'RaiseError' => 1});

  $drh = DBI->install_driver("\mysql");

I am not sure what is wrong.

I get the following error:

"Global sysmbol "$drh" requires explicit package name at dbtest.pl line 12"

Am I going about the the correct way?  I have created the table and added a number if 
items to the table.
I can look at the table with WinMySQL.adminVer 1.4 for Win95/Win98/NT/Win2000.

Thanks ,

Jerry




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: first dbi access with perl and lost

2002-09-22 Thread Gerald Preston

David,

Thanks,

Now I am getting the following:

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC contains; C:/Perl/lib 
C:/Perlsite/lib .) at (eval 1)
line 3;

I can't mysql.pm on my PC.  Was it not generated when I installed MySQL?  How do I fix 
this?

Thanks,

Jerry

David Lloyd wrote:

> Gerald,
>
> > #!perl
> >
> >   use strict;
> >   use DBI();
> >
> >   # Connect to the database.
> >   my $dbh = DBI->connect("DBI:mysql:database=club;host=localhost",
> >"jwp", "x",
> >  {'RaiseError' => 1});
> >
> >   $drh = DBI->install_driver("\mysql");
> >
> > I am not sure what is wrong.
> >
> > I get the following error:
> >
> > "Global sysmbol "$drh" requires explicit package name at dbtest.pl line 12"
>
> That's a Perl error.
>
> You've told Perl not to allow you to use a variable unless you declare
> it with:
>
> my
> local
> our
> (and possibly other keywords but these are the most common)
>
> If you substitute:
>
> my $drh=
>
> ...then you'll be fine.
>
> You might want to find out more information on what the "use strict"
> actually does too. A good place would be the perl documentation
> (perldoc) or http://www.perl.org/
>
> Hope this helps.
>
> DSL
>
> [mysql,query]
> --
> I reniad lin ne mor, nuithannen
>   In gwidh ristennin, i fae narchannen
> I lach Anor ed ardhon gwannen
>   (Soundtrack LOTR)



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: first dbi access with perl and lost

2002-09-22 Thread Gerald Preston

David,

I am not getting any where..   Do I have create mysql.pm on my system or can 
just copy the file onto my system.
I do not understand why MySQL did not create this file.

Thanks,

Jerry

David Lloyd wrote:

> Gerald,
>
> > Now I am getting the following:
> >
> > install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC contains; 
>C:/Perl/lib C:/Perlsite/lib .) at (eval 1)
> > line 3;
> >
> > I can't mysql.pm on my PC.  Was it not generated when I installed MySQL?  How do I 
>fix this?
>
> No, it's separate from the distribution of MySQL.
>
> If you're using ActiveState then start the "ppm" (Perl Package Manager
> Utility) and look for:
>
>   DBD::mysql
>
> You'll find it here:
>
>   * http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?request=search
>
>   (Search for DBD::mysql)
>
> I don't really know the best way to install Perl modules on Windows (I
> avoid Windows like the plague).
>
> DSL
> --
> I reniad lin ne mor, nuithannen
>   In gwidh ristennin, i fae narchannen
> I lach Anor ed ardhon gwannen
>   (Soundtrack LOTR)



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: first dbi access with perl and lost

2002-09-22 Thread Gerald Preston

Paul,

Thank you!!  I had installed DBD, but I did not know that I had to install DBD::mysql.

THANKS SO MUCH!!!

Jerry

Paul DuBois wrote:

> At 13:33 -0500 9/22/02, Gerald Preston wrote:
> >David,
> >
> >I am not getting any where..   Do I have create mysql.pm on
> >my system or can just copy the file onto my system.
> >I do not understand why MySQL did not create this file.
>
> Because it's not part of MySQL.  It's part of DBD::mysql, the MySQL-specific
> driver for the DBI module.
>
> Since you say you're not getting anywhere, but do not specify what you've
> tried, all we can say is follow the directions you've already been given.
> That is, use ppm to install the DBD::mysql module.
>
> Invoke the ppm program, then run this command:
>
> install DBD::mysql
>
> >Thanks,
> >
> >Jerry
> >
> >David Lloyd wrote:
> >
> >>  Gerald,
> >>
> >>  > Now I am getting the following:
> >>  >
> >>  > install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC
> >>contains; C:/Perl/lib C:/Perlsite/lib .) at (eval 1)
> >>  > line 3;
> >>  >
> >>  > I can't mysql.pm on my PC.  Was it not generated when I
> >>installed MySQL?  How do I fix this?
> >>
> >>  No, it's separate from the distribution of MySQL.
> >>
> >>  If you're using ActiveState then start the "ppm" (Perl Package Manager
> >>  Utility) and look for:
> >>
> >>DBD::mysql
> >>
> >>  You'll find it here:
> >>
> >>* http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?request=search
> >>
> >>(Search for DBD::mysql)
> >>
> >>  I don't really know the best way to install Perl modules on Windows (I
> >>  avoid Windows like the plague).
> >>
> >>  DSL
> >>  --
> >>  I reniad lin ne mor, nuithannen
> >>In gwidh ristennin, i fae narchannen
> >>  I lach Anor ed ardhon gwannen
> >>(Soundtrack LOTR)
> >
> >
> >
> >-
> >Before posting, please check:
> >http://www.mysql.com/manual.php   (the manual)
> >http://lists.mysql.com/   (the list archive)
> >
> >To request this thread, e-mail <[EMAIL PROTECTED]>
> >To unsubscribe, e-mail <[EMAIL PROTECTED]>
> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php