RE: Binary releases for DBI and DBD:Oracle for ActivePerl Build 808

2004-01-20 Thread Andrews, Mark
I encountered a very similar problem to this on a Windows XP machine.  I
had ActiveState perl 5.6 installed.  I upgraded to 5.8.2 and installed
DBI from the standard repository and the 5.8.2 DBD-Oracle from
ftp.esoftmatic.com/outgoing/DBI/5.8.2.  I got the same error described
by the original poster.  I found that the solution that worked for me
was to uninstall perl and completely erase the perl directory.  I
reinstalled perl, DBI, and DBD-Oracle and everything works just fine
now.

Mark

-Original Message-
From: Jeff Urlwin [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 10:37 AM
To: 'Paul Clements'; [EMAIL PROTECTED]
Subject: RE: Binary releases for DBI and DBD:Oracle for ActivePerl Build
808


It sounds like you were running the older .dll from the newer perl.  

Are you sure you:
a) Didn't have the Oracle.dll loaded so that ppm failed to
overwrite it?
(reboot and re-run ppm should fix it, I would think)
b) On one machine, when I overwrote 5.6.1 (build 63x) with 5.8.2
(808), it asked me to reboot, did you?

I *just* installed a fresh 808 on a machine, did the ppm and ran a test
script that did a select * from tab.  It worked.

Jeff


 -Original Message-
 From: Paul Clements [mailto:[EMAIL PROTECTED]
 Sent: Friday, January 16, 2004 7:57 AM
 To: Jeff Urlwin; [EMAIL PROTECTED]
 Subject: RE: Binary releases for DBI and DBD:Oracle for 
 ActivePerl Build 808
 
 
 Jeff,
  
 Thanks for getting back to me as requested I have appended
 the results of perl -v are
  This is perl, v5.8.2 built for MSWin32-x86-multi-thread
  (with 25 registered patches, see perl -V for more detail)
  
  Copyright 1987-2003,  Larry Wall
  
   Binary build 808 provided by ActiveState Corp.
 http://www.ActiveState.com
   ActiveState is a division of Sophos.
   Built  Dec  9 2003 10:19:40
 Regards
  
 Paul Clements
 
   -Original Message- 
   From: Jeff Urlwin [mailto:[EMAIL PROTECTED] 
   Sent: Fri 16/01/2004 12:22 
   To: Paul Clements; [EMAIL PROTECTED] 
   Cc: 
   Subject: RE: Binary releases for DBI and DBD:Oracle for
 ActivePerl Build 808
   
   
Hi,

I have just downloaded 5.8.2 Build 808 from ActiveState and
the 5.8.2 branch of DBI and DBD:Oracle from
ftp.esoftmatic.com/outgoing/DBI/5.8.2

Unfortunately I get the error
  The procedure entry point Perl_Glockhook_ptr could not be
located in the dynamic link library perl58.dll

From browsing the web it looks like this is only built for
Build 807, hence does anyone know where I can get a binary
build for 808.
   
   Please do a perl -v on your perl version.  I think you
 are getting the wrong
   version.
   
   Jeff
   
 
 
 __
 __
 
 NOTICE: The information contained in this e-mail is
 confidential. If you have received this by mistake you should 
 not disclose, copy, circulate or in any other way use the 
 information contained herein. This e-mail may be legally 
 privileged and unauthorised use may be unlawful. If you have 
 received this e-mail in error, please telephone us on 01709 
 300 900 immediately so we can arrange for its return. Please 
 then delete your copy.
 
 This email has been scanned for all viruses by the
 MessageLabs Email Security System. 
 __
 __
 




Need some MySQL query help...

2004-01-20 Thread NIPP, SCOTT V (SBCSI)
I am working on a set of Perl scripts, along with some PHP web
pages, to help organize and automate user account creation in a large HP-UX
environment.  I am currently writing a few scripts to gather all of the
existing user account data from every system and populate a couple of
database tables.  One feature I am working on is to have a history table to
track all changes to user accounts.  
I am currently working on the logic of the script that populates the
database tables and what I am attempting to do is compare the existing
passwd entry to the current database entry.  The Primary Key on the current
table (acct_db) is a combination of userID and hostname.  I want the query
to match the Primary Key, and compare all of the data in the passwd file to
the data in this table.  Assuming the data is all a match, nothing happens,
the script simply proceeds to the next entry.  If however there is a
difference, the script should delete the entry and populate this same entry
into the history table (acct_hist) and also insert the new data into the
current table.
This is where I am currently running into problems.  I am not sure
exactly how to test for inequality of all the variables in the passwd file.
I was hoping to have a single MySQL query do the test in order to use it to
help simplify the Perl code.  The SELECT statement is where I think I am
going wrong here.  Here is the code loop that processes the passwd file
data:

while ($file = readdir(DATA)) {
  if ($file =~ /passwd/) {
($host) = split /\./, $file, 2;
print Password file for $host found.  Now processing...\n;
open(FILE, /usr/local/mysql/tmp_data/$file);
while ($entry = FILE) {
  ($name, $passwd, $uid, $gid, $gcos, $home, $shell) =
split(/:/,$entry);
  if ($uid  100) {
$key1 = $name.-.$host;
my $test = $dbh-prepare(SELECT * FROM acct_db WHERE key1 = '$key1'
AND (uid  '$uid' OR gid  '$gid' OR gcos  '$gcos' OR home  '$home' OR
shell  '$shell'));
$test-execute ();
$rows = $test-rows;
if ($rows == 0) {
  $dbh-do(INSERT INTO acct_db
VALUES('$key1','$uid','$gid','$gcos','$home','$shell',NOW()))
or print Error updating database:  , $dbh-errstr, \n;(
  print Adding $key1 to password database. \n;
} elsif ($rows == 1) {
  print $key1 already in database.  Updating entry now.\n;
}  else {
  print Error. \n;
}
  }
}
  }
}

Thanks in advance for any help.  

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com




Re: Need some MySQL query help...

2004-01-20 Thread Hardy Merrill
You're saying that you have a problem and that you think the problem is
in the matching logic in the SELECT, but you don't say exactly _what_ is
happening.  Put some prints in so you can see the values of the
variables you are plugging into the sql - make sure those values match
what you are expecting.  If that doesn't tell you enough, you can try
using DBI's trace method to help you see exactly what values are being
passed to the database.

I also suggest using placeholders - if you have quoting issues,
placeholders will solve those for you.  And they'll make things run
faster.  Read about placeholders by doing

   perldoc DBI

at a command prompt and searching(using the forward slash /) for
Placeholder.  Those perldocs also describe using trace.

HTH.

Hardy Merrill

 NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 01/20/04 10:48AM 
I am working on a set of Perl scripts, along with some PHP web
pages, to help organize and automate user account creation in a large
HP-UX
environment.  I am currently writing a few scripts to gather all of
the
existing user account data from every system and populate a couple of
database tables.  One feature I am working on is to have a history
table to
track all changes to user accounts.  
I am currently working on the logic of the script that populates
the
database tables and what I am attempting to do is compare the existing
passwd entry to the current database entry.  The Primary Key on the
current
table (acct_db) is a combination of userID and hostname.  I want the
query
to match the Primary Key, and compare all of the data in the passwd
file to
the data in this table.  Assuming the data is all a match, nothing
happens,
the script simply proceeds to the next entry.  If however there is a
difference, the script should delete the entry and populate this same
entry
into the history table (acct_hist) and also insert the new data into
the
current table.
This is where I am currently running into problems.  I am not
sure
exactly how to test for inequality of all the variables in the passwd
file.
I was hoping to have a single MySQL query do the test in order to use
it to
help simplify the Perl code.  The SELECT statement is where I think I
am
going wrong here.  Here is the code loop that processes the passwd
file
data:

while ($file = readdir(DATA)) {
  if ($file =~ /passwd/) {
($host) = split /\./, $file, 2;
print Password file for $host found.  Now processing...\n;
open(FILE, /usr/local/mysql/tmp_data/$file);
while ($entry = FILE) {
  ($name, $passwd, $uid, $gid, $gcos, $home, $shell) =
split(/:/,$entry);
  if ($uid  100) {
$key1 = $name.-.$host;
my $test = $dbh-prepare(SELECT * FROM acct_db WHERE key1 =
'$key1'
AND (uid  '$uid' OR gid  '$gid' OR gcos  '$gcos' OR home 
'$home' OR
shell  '$shell'));
$test-execute ();
$rows = $test-rows;
if ($rows == 0) {
  $dbh-do(INSERT INTO acct_db
VALUES('$key1','$uid','$gid','$gcos','$home','$shell',NOW()))
or print Error updating database:  , $dbh-errstr, \n;(
  print Adding $key1 to password database. \n;
} elsif ($rows == 1) {
  print $key1 already in database.  Updating entry now.\n;
}  else {
  print Error. \n;
}
  }
}
  }
}

Thanks in advance for any help.  

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED] 
Web:  http:\\ldsa.sbcld.sbc.com




RE: Need some MySQL query help...

2004-01-20 Thread NIPP, SCOTT V (SBCSI)
Thanks for the feedback.  I am getting an error during the compile.
I think my problem is in the structure of the SELECT statement.  I was
taking a guess on how to test for inequality.  My guess now is that the 
is simply invalid, and this is where my problem is coming from.  Here again
is the SELECT statement that I think is the problem, along with output from
attempting to run the script:

my $test = $dbh-prepare(SELECT * FROM acct_db WHERE key1 = '$key1' AND
(uid  '$uid' OR gid  '$gid' OR gcos  '$gcos' OR home  '$home' OR
shell  '$shell'));
$test-execute ();

***  OUTPUT  ***
syntax error at ./passwd2db.pl line 34, near Adding $key1 to password
database
. \n;
Execution of ./passwd2db.pl aborted due to compilation errors.

In the mean time, I'll start reading up on using placeholders too.
Thanks again.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: Hardy Merrill [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 20, 2004 10:13 AM
To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI)
Subject: Re: Need some MySQL query help...


You're saying that you have a problem and that you think the problem is
in the matching logic in the SELECT, but you don't say exactly _what_ is
happening.  Put some prints in so you can see the values of the
variables you are plugging into the sql - make sure those values match
what you are expecting.  If that doesn't tell you enough, you can try
using DBI's trace method to help you see exactly what values are being
passed to the database.

I also suggest using placeholders - if you have quoting issues,
placeholders will solve those for you.  And they'll make things run
faster.  Read about placeholders by doing

   perldoc DBI

at a command prompt and searching(using the forward slash /) for
Placeholder.  Those perldocs also describe using trace.

HTH.

Hardy Merrill

 NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 01/20/04 10:48AM 
I am working on a set of Perl scripts, along with some PHP web
pages, to help organize and automate user account creation in a large
HP-UX
environment.  I am currently writing a few scripts to gather all of
the
existing user account data from every system and populate a couple of
database tables.  One feature I am working on is to have a history
table to
track all changes to user accounts.  
I am currently working on the logic of the script that populates
the
database tables and what I am attempting to do is compare the existing
passwd entry to the current database entry.  The Primary Key on the
current
table (acct_db) is a combination of userID and hostname.  I want the
query
to match the Primary Key, and compare all of the data in the passwd
file to
the data in this table.  Assuming the data is all a match, nothing
happens,
the script simply proceeds to the next entry.  If however there is a
difference, the script should delete the entry and populate this same
entry
into the history table (acct_hist) and also insert the new data into
the
current table.
This is where I am currently running into problems.  I am not
sure
exactly how to test for inequality of all the variables in the passwd
file.
I was hoping to have a single MySQL query do the test in order to use
it to
help simplify the Perl code.  The SELECT statement is where I think I
am
going wrong here.  Here is the code loop that processes the passwd
file
data:

while ($file = readdir(DATA)) {
  if ($file =~ /passwd/) {
($host) = split /\./, $file, 2;
print Password file for $host found.  Now processing...\n;
open(FILE, /usr/local/mysql/tmp_data/$file);
while ($entry = FILE) {
  ($name, $passwd, $uid, $gid, $gcos, $home, $shell) =
split(/:/,$entry);
  if ($uid  100) {
$key1 = $name.-.$host;
my $test = $dbh-prepare(SELECT * FROM acct_db WHERE key1 =
'$key1'
AND (uid  '$uid' OR gid  '$gid' OR gcos  '$gcos' OR home 
'$home' OR
shell  '$shell'));
$test-execute ();
$rows = $test-rows;
if ($rows == 0) {
  $dbh-do(INSERT INTO acct_db
VALUES('$key1','$uid','$gid','$gcos','$home','$shell',NOW()))
or print Error updating database:  , $dbh-errstr, \n;(
  print Adding $key1 to password database. \n;
} elsif ($rows == 1) {
  print $key1 already in database.  Updating entry now.\n;
}  else {
  print Error. \n;
}
  }
}
  }
}

Thanks in advance for any help.  

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED] 
Web:  http:\\ldsa.sbcld.sbc.com



Fw: Need some MySQL query help...

2004-01-20 Thread Patricia . Markiewicz




You can try a != instead of the  for not equal.

- Forwarded by Patricia A Markiewicz/US/DNY on 01/20/2004 10:38 AM
-
   
 NIPP, SCOTT V
 (SBCSI)  
 [EMAIL PROTECTED]   To 
   Hardy Merrill   
 01/20/2004 10:23  [EMAIL PROTECTED],
 AM[EMAIL PROTECTED]  
cc 
   
   Subject 
   RE: Need some MySQL query help...   
   
   
   
   
   
   




 Thanks for the feedback.  I am getting an error during the
compile.
I think my problem is in the structure of the SELECT statement.  I was
taking a guess on how to test for inequality.  My guess now is that the

is simply invalid, and this is where my problem is coming from.  Here again
is the SELECT statement that I think is the problem, along with output from
attempting to run the script:

my $test = $dbh-prepare(SELECT * FROM acct_db WHERE key1 = '$key1' AND
(uid  '$uid' OR gid  '$gid' OR gcos  '$gcos' OR home  '$home' OR
shell  '$shell'));
$test-execute ();

***  OUTPUT  ***
syntax error at ./passwd2db.pl line 34, near Adding $key1 to password
database
. \n;
Execution of ./passwd2db.pl aborted due to compilation errors.

 In the mean time, I'll start reading up on using placeholders
too.
Thanks again.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: Hardy Merrill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 10:13 AM
To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI)
Subject: Re: Need some MySQL query help...


You're saying that you have a problem and that you think the problem is
in the matching logic in the SELECT, but you don't say exactly _what_ is
happening.  Put some prints in so you can see the values of the
variables you are plugging into the sql - make sure those values match
what you are expecting.  If that doesn't tell you enough, you can try
using DBI's trace method to help you see exactly what values are being
passed to the database.

I also suggest using placeholders - if you have quoting issues,
placeholders will solve those for you.  And they'll make things run
faster.  Read about placeholders by doing

   perldoc DBI

at a command prompt and searching(using the forward slash /) for
Placeholder.  Those perldocs also describe using trace.

HTH.

Hardy Merrill

 NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 01/20/04 10:48AM 
 I am working on a set of Perl scripts, along with some PHP web
pages, to help organize and automate user account creation in a large
HP-UX
environment.  I am currently writing a few scripts to gather all of
the
existing user account data from every system and populate a couple of
database tables.  One feature I am working on is to have a history
table to
track all changes to user accounts.
 I am currently working on the logic of the script that
populates
the
database tables and what I am attempting to do is compare the existing
passwd entry to the current database entry.  The Primary Key on the
current
table (acct_db) is a combination of userID and hostname.  I want the
query
to match the Primary Key, and compare all of the data in the passwd
file to
the data in this table.  Assuming the data is all a match, nothing
happens,
the script simply proceeds to the next entry.  If however there is a
difference, the script should delete the entry and populate this same
entry
into the history table (acct_hist) and also insert the new data into
the
current table.
 This is where I am currently running into problems.  I am not
sure
exactly how to test for inequality of all the variables in the passwd
file.
I was hoping to have a single MySQL query do the test in order to use
it to
help simplify the Perl code.  The SELECT statement is where I think I
am
going wrong here.  Here is the code loop that processes the passwd
file
data:

while ($file = readdir(DATA)) {
  if ($file =~ /passwd/) {
($host) = split /\./, $file, 2;
print Password file for 

Quick DBI:ODBC question...

2004-01-20 Thread Herbold, John W.
I am trying to hit a MS SQL server using DBI:ODBC from an win2k box.  I have
the odbc client setup on my box, but I can not get the perl to hit it.  Any
help would be great!  I use DB2 with no problem and am trying the MSSQL
world (not by choice ;-).  Here is what I am trying to run...

# I have the odbc connection setup as MSSQL

 my $dbh = DBI-connect('dbi:ODBC:database=MSSQL',
'jwherbol','ttt55ttt');   if ($DBI::errstr) {print $DBI::errstr;}
 print Connection to DB returned: $DBI::errstr\n;
 my $sql =  qq|select count(*) from IISLog|;
 my $sth = $dbh-prepare($sql);
 print Prepare on SQL code returned: $DBI::errstr\n;
 my $rc  = $sth-execute;
 print Execute to DB returned $rc\n;
 while (($T1) = $sth-fetchrow_array() ) {
print SQL Query returned $T1\n;
 }  
 $dbh-disconnect; 


Thanks!

John W. Herbold Jr.





RE: [dbi] Quick DBI:ODBC question...

2004-01-20 Thread Martin J. Evans
I think that should be 'dbi:ODBC:DSN=MSSQL' or 'dbi:ODBC:MSSQL' but the error
message would have helped.

Martin
-- 
Martin J. Evans
Easysoft Ltd, UK
Development


On 20-Jan-2004 Herbold, John W. wrote:
 I am trying to hit a MS SQL server using DBI:ODBC from an win2k box.  I have
 the odbc client setup on my box, but I can not get the perl to hit it.  Any
 help would be great!  I use DB2 with no problem and am trying the MSSQL
 world (not by choice ;-).  Here is what I am trying to run...
 
# I have the odbc connection setup as MSSQL
 
  my $dbh = DBI-connect('dbi:ODBC:database=MSSQL',
 'jwherbol','ttt55ttt');   if ($DBI::errstr) {print $DBI::errstr;}
  print Connection to DB returned: $DBI::errstr\n;
  my $sql =  qq|select count(*) from IISLog|;
  my $sth = $dbh-prepare($sql);
  print Prepare on SQL code returned: $DBI::errstr\n;
  my $rc  = $sth-execute;
  print Execute to DB returned $rc\n;
  while (($T1) = $sth-fetchrow_array() ) {
   print SQL Query returned $T1\n;
  }  
  $dbh-disconnect; 
 
 
 Thanks!
 
 John W. Herbold Jr.


Memory leak?: execute() with bind values (again?)

2004-01-20 Thread Zhivko Duchev
Hello All,

I think this is is an old known problem 
(http://www.mail-archive.com/[EMAIL PROTECTED]/msg18506.html), but just to 
be sure:
There is a memory leak when using binding and multiply executes also in 
DBD::Pg 1.31.

The following script reproduces the problem:
use DBI ;
use DBD::Pg qw/:pg_types/;

my 
$dbh1=DBI-connect(DBI:Pg:dbname='blob_test';host='torro';port='5432','duchev','') 
or die 'err';

  $sqltext=INSERT INTO delme3 (v) VALUES(?);
  $sth1=$dbh1-prepare($sqltext);
  $md=999;

  for ($i=1;$i100;$i++) {
$sth1-bind_param(1,$md, {pg_type=DBD::Pg::PG_INT8});
$sth1-execute;
#$dbh1-do($sqltext ,{pg_type=DBD::Pg::PG_INT8},$md);
  }
  $sth1-finish;
  $dbh1-disconnect;


The problem was not observed when using 'do'.
This was tested with Perl 5.6.1 and DBI 1.38 and 1.40

Any suggestions?
Thanks!


Zhivko Duchev
===
Institute for Animal Breeding
Mariensee 31535 Neustadt Germany
===



Re: Quick DBI:ODBC question...

2004-01-20 Thread David N Murray
What's the error that's returned?

I looked at some code that I use for ODBC, and my format is
DBI-connect('dbi:ODBC:dsn','username','password'),  not 'database=dsn'.

HTH,
Dave

On Jan 20, Herbold, John W. scribed:

 I am trying to hit a MS SQL server using DBI:ODBC from an win2k box.  I have
 the odbc client setup on my box, but I can not get the perl to hit it.  Any
 help would be great!  I use DB2 with no problem and am trying the MSSQL
 world (not by choice ;-).  Here is what I am trying to run...

 # I have the odbc connection setup as MSSQL

  my $dbh = DBI-connect('dbi:ODBC:database=MSSQL',
 'jwherbol','ttt55ttt');   if ($DBI::errstr) {print $DBI::errstr;}
  print Connection to DB returned: $DBI::errstr\n;
  my $sql =  qq|select count(*) from IISLog|;
  my $sth = $dbh-prepare($sql);
  print Prepare on SQL code returned: $DBI::errstr\n;
  my $rc  = $sth-execute;
  print Execute to DB returned $rc\n;
  while (($T1) = $sth-fetchrow_array() ) {
   print SQL Query returned $T1\n;
  }
  $dbh-disconnect;


 Thanks!

 John W. Herbold Jr.





RE: Need some MySQL query help...

2004-01-20 Thread Ronald Kimball
 

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 20, 2004 11:23 AM
 To: Hardy Merrill; [EMAIL PROTECTED]
 Subject: RE: Need some MySQL query help...

 ***  OUTPUT  ***
 syntax error at ./passwd2db.pl line 34, near Adding $key1 
 to password
 database
 . \n;
 Execution of ./passwd2db.pl aborted due to compilation errors.

That's a Perl syntax error, not an SQL syntax error.

  $dbh-do(INSERT INTO acct_db
VALUES('$key1','$uid','$gid','$gcos','$home','$shell',NOW()))
or print Error updating database:  , $dbh-errstr, \n;(
  print Adding $key1 to password database. \n;

You have a spurious left parenthesis at the end of the $dbh-do() line.
Right
where the syntax error was reported.

Ronald



RE: Quick DBI:ODBC question...

2004-01-20 Thread Herbold, John W.
Peter showed me the error of my ways

my $dbh = DBI-connect('dbi:ODBC:MSSQL', 'ID','password');   if
($DBI::errstr) {print $DBI::errstr;}

And for future reference the error was:

Data source name not found and no default driver specified (SQL-IM002)

Thanks,

John W. Herbold Jr.




-Original Message-
From: David N Murray [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 11:08 AM
To: Herbold, John W.
Cc: [EMAIL PROTECTED]
Subject: Re: Quick DBI:ODBC question...


What's the error that's returned?

I looked at some code that I use for ODBC, and my format is
DBI-connect('dbi:ODBC:dsn','username','password'),  not 'database=dsn'.

HTH,
Dave

On Jan 20, Herbold, John W. scribed:

 I am trying to hit a MS SQL server using DBI:ODBC from an win2k box.  I
have
 the odbc client setup on my box, but I can not get the perl to hit it.
Any
 help would be great!  I use DB2 with no problem and am trying the MSSQL
 world (not by choice ;-).  Here is what I am trying to run...

 # I have the odbc connection setup as MSSQL

  my $dbh = DBI-connect('dbi:ODBC:database=MSSQL',
 'jwherbol','ttt55ttt');   if ($DBI::errstr) {print $DBI::errstr;}
  print Connection to DB returned: $DBI::errstr\n;
  my $sql =  qq|select count(*) from IISLog|;
  my $sth = $dbh-prepare($sql);
  print Prepare on SQL code returned: $DBI::errstr\n;
  my $rc  = $sth-execute;
  print Execute to DB returned $rc\n;
  while (($T1) = $sth-fetchrow_array() ) {
   print SQL Query returned $T1\n;
  }
  $dbh-disconnect;


 Thanks!

 John W. Herbold Jr.






RE: Need some MySQL query help...

2004-01-20 Thread NIPP, SCOTT V (SBCSI)
Thanks for the feedback, this did the trick for me.

The next question I have is regarding a good way to archive changes.
I have already created a separate archive table.  I am mainly curious as to
if there is a standard method of moving a row from one table to another.  If
I were to script this manually, I would assume that I select the data and
capture the fields as variable and then have an insert statement to put this
data into the archive table.  At this point, I would then delete the
existing row from the current table and then insert the new data into the
current table.  I am just curious as to if there is a better way than doing
all of this.
The archive table has two additional fields.  Not sure if this makes
any difference or not.  The first new field is the Primary Key, which is a
simple autoincrement field.  The other extra field is a date field for when
this change was archived off.  I know that this is actually redundant,
however, I think it will make some of the other tools easier to write later.
Thanks again for the help.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 20, 2004 10:39 AM
To: [EMAIL PROTECTED]
Subject: Fw: Need some MySQL query help...






You can try a != instead of the  for not equal.

- Forwarded by Patricia A Markiewicz/US/DNY on 01/20/2004 10:38 AM
-
   
 NIPP, SCOTT V
 (SBCSI)  
 [EMAIL PROTECTED]   To 
   Hardy Merrill   
 01/20/2004 10:23  [EMAIL PROTECTED],
 AM[EMAIL PROTECTED]  
cc 
   
   Subject 
   RE: Need some MySQL query help...   
   
   
   
   
   
   




 Thanks for the feedback.  I am getting an error during the
compile.
I think my problem is in the structure of the SELECT statement.  I was
taking a guess on how to test for inequality.  My guess now is that the

is simply invalid, and this is where my problem is coming from.  Here again
is the SELECT statement that I think is the problem, along with output from
attempting to run the script:

my $test = $dbh-prepare(SELECT * FROM acct_db WHERE key1 = '$key1' AND
(uid  '$uid' OR gid  '$gid' OR gcos  '$gcos' OR home  '$home' OR
shell  '$shell'));
$test-execute ();

***  OUTPUT  ***
syntax error at ./passwd2db.pl line 34, near Adding $key1 to password
database
. \n;
Execution of ./passwd2db.pl aborted due to compilation errors.

 In the mean time, I'll start reading up on using placeholders
too.
Thanks again.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: Hardy Merrill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 10:13 AM
To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI)
Subject: Re: Need some MySQL query help...


You're saying that you have a problem and that you think the problem is
in the matching logic in the SELECT, but you don't say exactly _what_ is
happening.  Put some prints in so you can see the values of the
variables you are plugging into the sql - make sure those values match
what you are expecting.  If that doesn't tell you enough, you can try
using DBI's trace method to help you see exactly what values are being
passed to the database.

I also suggest using placeholders - if you have quoting issues,
placeholders will solve those for you.  And they'll make things run
faster.  Read about placeholders by doing

   perldoc DBI

at a command prompt and searching(using the forward slash /) for
Placeholder.  Those perldocs also describe using trace.

HTH.

Hardy Merrill

 NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 01/20/04 10:48AM 
 I am working on a set of Perl scripts, along with some PHP web
pages, to help organize and automate user account creation in a large
HP-UX
environment.  I am currently writing a few scripts to gather all of
the
existing 

RE: Binary releases for DBI and DBD:Oracle for ActivePerl Build 808

2004-01-20 Thread Jeff Urlwin
FYI, You should *always* try to get DBI and DBD::xxx from my site if you are
going to get it at all.  Reason: the DBI has some internal versioning issues
upon which DBDs are dependant.  Getting DBI Version X from one place and
DBD::Y which was not built with DBI version X, can cause issues...

Regards,

Jeff


 -Original Message-
 From: Andrews, Mark [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 20, 2004 8:45 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Binary releases for DBI and DBD:Oracle for 
 ActivePerl Build 808
 
 
 I encountered a very similar problem to this on a Windows XP 
 machine.  I had ActiveState perl 5.6 installed.  I upgraded 
 to 5.8.2 and installed DBI from the standard repository and 
 the 5.8.2 DBD-Oracle from 
 ftp.esoftmatic.com/outgoing/DBI/5.8.2.  I got the same error 
 described by the original poster.  I found that the solution 
 that worked for me was to uninstall perl and completely erase 
 the perl directory.  I reinstalled perl, DBI, and DBD-Oracle 
 and everything works just fine now.
 
 Mark
 
 -Original Message-
 From: Jeff Urlwin [mailto:[EMAIL PROTECTED] 
 Sent: Friday, January 16, 2004 10:37 AM
 To: 'Paul Clements'; [EMAIL PROTECTED]
 Subject: RE: Binary releases for DBI and DBD:Oracle for 
 ActivePerl Build 808
 
 
 It sounds like you were running the older .dll from the newer perl.  
 
 Are you sure you:
   a) Didn't have the Oracle.dll loaded so that ppm failed 
 to overwrite it?
   (reboot and re-run ppm should fix it, I would think)
   b) On one machine, when I overwrote 5.6.1 (build 63x) 
 with 5.8.2 (808), it asked me to reboot, did you?
 
 I *just* installed a fresh 808 on a machine, did the ppm and 
 ran a test script that did a select * from tab.  It worked.
 
 Jeff
 
 
  -Original Message-
  From: Paul Clements [mailto:[EMAIL PROTECTED]
  Sent: Friday, January 16, 2004 7:57 AM
  To: Jeff Urlwin; [EMAIL PROTECTED]
  Subject: RE: Binary releases for DBI and DBD:Oracle for
  ActivePerl Build 808
  
  
  Jeff,
   
  Thanks for getting back to me as requested I have appended 
 the results 
  of perl -v are
   This is perl, v5.8.2 built for MSWin32-x86-multi-thread
   (with 25 registered patches, see perl -V for more detail)
   
   Copyright 1987-2003,  Larry Wall
   
Binary build 808 provided by ActiveState Corp. 
  http://www.ActiveState.com
ActiveState is a division of Sophos.
Built  Dec  9 2003 10:19:40
  Regards
   
  Paul Clements
  
  -Original Message- 
  From: Jeff Urlwin [mailto:[EMAIL PROTECTED] 
  Sent: Fri 16/01/2004 12:22 
  To: Paul Clements; [EMAIL PROTECTED] 
  Cc: 
  Subject: RE: Binary releases for DBI and DBD:Oracle for 
 ActivePerl 
  Build 808
  
  
   Hi,
   
   I have just downloaded 5.8.2 Build 808 from ActiveState and
   the 5.8.2 branch of DBI and DBD:Oracle from
   ftp.esoftmatic.com/outgoing/DBI/5.8.2
   
   Unfortunately I get the error
 The procedure entry point Perl_Glockhook_ptr could not be
   located in the dynamic link library perl58.dll
   
   From browsing the web it looks like this is only built for
   Build 807, hence does anyone know where I can get a binary
   build for 808.
  
  Please do a perl -v on your perl version.  I think you
  are getting the wrong
  version.
  
  Jeff
  
  
  
  __
  __
  
  NOTICE: The information contained in this e-mail is 
 confidential. If 
  you have received this by mistake you should not disclose, copy, 
  circulate or in any other way use the information contained herein. 
  This e-mail may be legally privileged and unauthorised use may be 
  unlawful. If you have received this e-mail in error, please 
 telephone 
  us on 01709 300 900 immediately so we can arrange for its return. 
  Please then delete your copy.
  
  This email has been scanned for all viruses by the 
 MessageLabs Email 
  Security System. 
  __
  __
  
 
 
 




RE: Quick DBI:ODBC question...

2004-01-20 Thread Jeff Urlwin
 
 
 I am trying to hit a MS SQL server using DBI:ODBC from an 
 win2k box.  I have the odbc client setup on my box, but I can 
 not get the perl to hit it.  Any help would be great!  I use 
 DB2 with no problem and am trying the MSSQL world (not by 
 choice ;-).  Here is what I am trying to run...
 
 # I have the odbc connection setup as MSSQL
 
  my $dbh = DBI-connect('dbi:ODBC:database=MSSQL',
 'jwherbol','ttt55ttt');   if ($DBI::errstr) {print $DBI::errstr;}

The simplest thing is to setup a system DSN and use that.  For example if
your System DSN is MSSQL, then
dbi:ODBC:MSSQL is your connect string (remove databsase=).  Otherwise, if
you want a dynamic connect string, then search the archives and/or create a
DSN and look at what Windows creates in the registry  INI files...

Regards,

Jeff
 
 
 




Encrypting Data...

2004-01-20 Thread Tim Howell
This question isn't strictly DBI, but I wasn't sure where to ask.  Is there a 
preferred way to encrypt data stored in a database?  I'm developing an application 
that has higher security requirements than what I've done in the past and I want to 
make sure the data is safe.  I know that MySQL has an AES encrypt function, and I know 
about the Crypt:: modules, but I'm not sure what is typically used as a key (eg, when 
multiple users need to see the same data), etc.

Any advice would really be appreciated.  =)

Thanks!

--TWH


Installing DBD::mysql on MacOSX 10.3.2 (panther)

2004-01-20 Thread Eric Gorr
I am having great difficulty installing DBD::mysql on MacOSX 10.3.2
Server (panther). The full build log is below. The command I used to
install was:
  perl -MCPAN -e 'install DBD::mysql'

I am using the recent version of mysql installed from FINK.

Any ideas?

(If there is a better forum for this question, please let me know.)

CPAN: Storable loaded ok
Going to read /Users/xadmin/.cpan/Metadata
  Database was generated on Fri, 16 Jan 2004 09:52:41 GMT
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://archive.progeny.com/CPAN/authors/01mailrc.txt.gz
Going to read /Users/xadmin/.cpan/sources/authors/01mailrc.txt.gz
LWP not available
Fetching with Net::FTP:
  ftp://archive.progeny.com/CPAN/modules/02packages.details.txt.gz
Going to read
/Users/xadmin/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Tue, 20 Jan 2004 09:53:29 GMT
  HTTP::Date not available
LWP not available
Fetching with Net::FTP:
  ftp://archive.progeny.com/CPAN/modules/03modlist.data.gz
Going to read /Users/xadmin/.cpan/sources/modules/03modlist.data.gz
Going to write /Users/xadmin/.cpan/Metadata
Running install for module DBD::mysql
Running make for R/RU/RUDY/DBD-mysql-2.9003.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for
/Users/xadmin/.cpan/sources/authors/id/R/RU/RUDY/DBD-mysql-2.9003.tar.gz
ok
Scanning cache /Users/xadmin/.cpan/build for sizes
DBD-mysql-2.9003/
DBD-mysql-2.9003/t/
DBD-mysql-2.9003/t/mysql2.t
DBD-mysql-2.9003/t/akmisc.t
DBD-mysql-2.9003/t/60leaks.t
DBD-mysql-2.9003/t/10dsnlist.t
DBD-mysql-2.9003/t/ak-dbd.t
DBD-mysql-2.9003/t/50chopblanks.t
DBD-mysql-2.9003/t/mysql.t
DBD-mysql-2.9003/t/lib.pl
DBD-mysql-2.9003/t/40blobs.t
DBD-mysql-2.9003/t/40nulls.t
DBD-mysql-2.9003/t/insertid.t
DBD-mysql-2.9003/t/40listfields.t
DBD-mysql-2.9003/t/40bindparam.t
DBD-mysql-2.9003/t/mysql.dbtest
DBD-mysql-2.9003/t/dbdadmin.t
DBD-mysql-2.9003/t/20createdrop.t
DBD-mysql-2.9003/t/00base.t
DBD-mysql-2.9003/t/30insertfetch.t
DBD-mysql-2.9003/t/40numrows.t
DBD-mysql-2.9003/t/50commit.t
DBD-mysql-2.9003/t/mysql.mtest
DBD-mysql-2.9003/MANIFEST
DBD-mysql-2.9003/myld
DBD-mysql-2.9003/dbdimp.c
DBD-mysql-2.9003/lib/
DBD-mysql-2.9003/lib/DBD/
DBD-mysql-2.9003/lib/DBD/mysql/
DBD-mysql-2.9003/lib/DBD/mysql/GetInfo.pm
DBD-mysql-2.9003/lib/DBD/mysql/INSTALL.pod
DBD-mysql-2.9003/lib/DBD/mysql.pm
DBD-mysql-2.9003/lib/Mysql/
DBD-mysql-2.9003/lib/Mysql/Statement.pm
DBD-mysql-2.9003/lib/Bundle/
DBD-mysql-2.9003/lib/Bundle/DBD/
DBD-mysql-2.9003/lib/Bundle/DBD/mysql.pm
DBD-mysql-2.9003/lib/Mysql.pm
DBD-mysql-2.9003/dbdimp.h
DBD-mysql-2.9003/mysql.xs
DBD-mysql-2.9003/MANIFEST.SKIP
DBD-mysql-2.9003/README
DBD-mysql-2.9003/INSTALL.html
DBD-mysql-2.9003/Makefile.PL
DBD-mysql-2.9003/ChangeLog
DBD-mysql-2.9003/constants.h
DBD-mysql-2.9003/TODO
Removing previously used /Users/xadmin/.cpan/build/DBD-mysql-2.9003
  CPAN.pm: Going to build R/RU/RUDY/DBD-mysql-2.9003.tar.gz

I will use the following settings for compiling and testing:

  cflags(mysql_config) = -I/usr/include/mysql -O3
-fno-omit-frame-pointer -arch i386 -arch ppc -pipe
  libs  (mysql_config) = -arch i386 -arch ppc -pipe
-L/usr/lib/mysql -lmysqlclient -lz -lm
  nocatchstderr (default ) = 0
  nofoundrows   (default ) = 0
  ssl   (guessed ) = 0
  testdb(default ) = test
  testhost  (default ) =
  testpassword  (default ) =
  testuser  (default ) =
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
Checking if your kit is complete...
Looks good
Unrecognized argument in LIBS ignored: '-arch'
Unrecognized argument in LIBS ignored: 'i386'
Unrecognized argument in LIBS ignored: '-arch'
Unrecognized argument in LIBS ignored: 'ppc'
Unrecognized argument in LIBS ignored: '-pipe'
Using DBI 1.40 (for perl 5.008001 on darwin-thread-multi-2level)
installed in /Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBI
Writing Makefile for DBD::mysql
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/Mysql.pm blib/lib/Mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
cc -c  -I/Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBI
-I/usr/include/mysql -O3 -fno-omit-frame-pointer -arch i386 -arch ppc
-pipe -g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp
-fno-strict-aliasing -I/usr/local/include -Os   -DVERSION=\2.9003\
-DXS_VERSION=\2.9003\
-I/System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE
dbdimp.c
cc: cannot read specs file for arch `i386'
make: *** [dbdimp.o] Error 1
  /usr/bin/make  -- NOT OK
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible