Re: Running DBI, ODBC in the crontab

2006-04-11 Thread Jeffrey Seger
Run the following lines in both the command line and crontab:

perl -MData::Dumper -e' print Dumper @INC' >~/inc.log
env|sort >~/env.log

The first will have output that looks something like this:


perl -MData::Dumper -e' print Dumper @INC'
$VAR1 = '/usr/lib/perl5/5.8.7/i586-linux-thread-multi';
$VAR2 = '/usr/lib/perl5/5.8.7';
$VAR3 = '/usr/lib/perl5/site_perl/5.8.7/i586-linux-thread-multi';
$VAR4 = '/usr/lib/perl5/site_perl/5.8.7';
$VAR5 = '/usr/lib/perl5/site_perl';
$VAR6 = '/usr/lib/perl5/vendor_perl/5.8.7/i586-linux-thread-multi';
$VAR7 = '/usr/lib/perl5/vendor_perl/5.8.7';
$VAR8 = '/usr/lib/perl5/vendor_perl';
$VAR9 = '.';

Ignoring the "$VARn =" stuff, compare what is in the outputs on the command
line and on the crontab output.  Any of the paths that are missing in cron
should be added in cron.  There are a number of ways to do that, but what I
suggest is creating a .setenv.sh (or some name that makes sense to you) and
add the variables to your environment (PERL5LIB) by sourcing that file as
part of your cron command line.

Another way is to add the lines to the top of your crontab:

PERL5LIB=
LD_LIBRARY_PATH=

If you use the setenv.sh method:

0 0 * * * /home/jeff/bin/jeffsscript.pl
becomes:
0 0 * * * cd /home/jeff/bin/ ; . .setenv.sh ; /home/jeff/bin/jeffsscript.pl

If you add it to your crontab, then your crontab looks something like this:
PERL5LIB=
LD_LIBRARY_PATH=
0 0 * * * /home/jeff/bin/jeffsscript.pl

It's important to remember though that these variables get set for
everything that runs in this crontab if you do it this way, although they
can be overridden using the first method.



The differences between the cron execution of env and the command line will
be huge.

On my linux box env from the command line spits out 83 lines.  From cron it
is 10, and that includes some that I have added in. Most notably absent are
things like PERL5LIB and all of my ORACLE* variables.  Anything that might
help can be added in using one of the methods above.



On 4/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am running a perl script, using DBI and ODBC (from DataDirect), on a
> linux box to connect to SQL server.   It works fine if I run it from a shell
> command line.
>
> However, if I put it into a crontab (the same user), I got the following
> error:
>
> install_driver(ODBC) failed: Can't load
> '/QRT/ODBC/perlModule/myInstall/lib/auto/DBD/ODBC/ODBC.so' for module
> DBD::ODBC: libstdc++.so.5: cannot open shared object file: No such file or
> directory at /sbcimp/run/pd/perl/5.8.3/lib/DynaLoader.pm line 229.
>
>  at (eval 1) line 3
> Compilation failed in require at (eval 1) line 3.
> Perhaps a required shared library or dll isn't installed where expected
>
> The failure is at the line
>
> $dbh = DBI->connect
>
> Here is what I tried to diagnosis.
>
> 0. if I do "ldd /QRT/ODBC/perlModule/myInstall/lib/auto/DBD/ODBC/ODBC.so"
> from a shell command, there is a clear path associated with libstdc++.so.5
>
> 1. I checked (by printing out the environment variable's LD_LIBRARY_PATH
> within my perl script) the LD_LIBRARY_PATH, the path for item 0 is there.
>
> 2. if I repeat the item 0 within the perl script (when running in the
> crontab), the output indicates the library (ODBC.so) is fine with correct
> linkage.
>
> Every debugging output looks normal, and I just could not find the
> problem…
>
> It will be greatly appreciated if some expert can share his experience
> with me.
>
> Many thanks.
>
> Best,
>
> Stephen Chung
>
>
>
> This communication is issued by UBS AG or an affiliate ("UBS") by the
> Sales or Trading Department to institutional investors only and is
> not research. It is for informational purposes and is not an official
> confirmation of terms. It is not guaranteed as to accuracy, nor is it
> a complete statement of the financial products or markets referred
> to. Opinions expressed are subject to change without notice and may
> differ or be contrary to the opinions or recommendations of UBS
> Investment Research or the opinions expressed by other business areas
> or groups of UBS as a result of using different assumptions and
> criteria. UBS may, as principal or agent, have position in,
> underwrite, buy or sell, make a market in, or enter into derivatives
> transactions in relation to any financial instrument or asset
> referred to in this email. Unless stated specifically otherwise, this
> is not a recommendation, offer or solicitation to buy or sell and any
> prices or quotations contained herein are indicative only. UBS has
> policies and procedures designed to minimise the risk that that
> officers and employees are influenced by any conflicting interest or
> duty and that confidential information is improperly disclosed or
> made available. To the extent permitted by law, UBS does not accept
> any liability arising from the use of this communication.
> For additional information, please contact your local sales or
> trading contact. (c) 2005 UBS.  All rights reser

Re: problem DBD-Oracle-1.17 linux enterprise AS

2006-04-11 Thread Kevin Moore

Oscar,

Are there errors in your alert log? The ora-600 is a "generic" message. 
It's quite possible oracle generated a trace file that may also help.


Kevin

Oscar Gomez wrote:


i have this error when i made interface program perl with oracle 10g trough
DBD module.
DBD::Oracle::st execute failed: ORA-00600: internal error code, arguments:
[kpofdr-long], [], [], [], [], [], [], [] (DBD ERROR: error possibly near <*>
indicator at char 37 in 'select
   itmpar, texpar
   from useru.<*>par
   where ciapar = :p1 
   and  fampar = :p2 ') [for Statement "select

   itmpar, texpar
   from useru.par
   where ciapar = ? 
   and  fampar = ? " with ParamValues: :p1=0, :p2='py-ley'] at

./1230.pl line 28.

but,if I execute it for the second time it work ok.

thanks 
--

Open WebMail Project (http://openwebmail.org)
--- End of Forwarded Message ---


--
Open WebMail Project (http://openwebmail.org)



 






Running DBI, ODBC in the crontab

2006-04-11 Thread Stephen . Chung
Title: Running DBI, ODBC in the crontab






Hi, 


I am running a perl script, using DBI and ODBC (from DataDirect), on a linux box to connect to SQL server.   It works fine if I run it from a shell command line.

However, if I put it into a crontab (the same user), I got the following error:


install_driver(ODBC) failed: Can't load '/QRT/ODBC/perlModule/myInstall/lib/auto/DBD/ODBC/ODBC.so' for module DBD::ODBC: libstdc++.so.5: cannot open shared object file: No such file or directory at /sbcimp/run/pd/perl/5.8.3/lib/DynaLoader.pm line 229.

 at (eval 1) line 3

Compilation failed in require at (eval 1) line 3.

Perhaps a required shared library or dll isn't installed where expected


The failure is at the line


$dbh = DBI->connect


Here is what I tried to diagnosis.


0. if I do "ldd /QRT/ODBC/perlModule/myInstall/lib/auto/DBD/ODBC/ODBC.so" from a shell command, there is a clear path associated with libstdc++.so.5

1. I checked (by printing out the environment variable's LD_LIBRARY_PATH within my perl script) the LD_LIBRARY_PATH, the path for item 0 is there.

2. if I repeat the item 0 within the perl script (when running in the crontab), the output indicates the library (ODBC.so) is fine with correct linkage.

Every debugging output looks normal, and I just could not find the problem… 


It will be greatly appreciated if some expert can share his experience with me.


Many thanks.


Best,



Stephen Chung





This communication is issued by UBS AG or an affiliate ("UBS") by the
Sales or Trading Department to institutional investors only and is
not research. It is for informational purposes and is not an official
confirmation of terms. It is not guaranteed as to accuracy, nor is it
a complete statement of the financial products or markets referred
to. Opinions expressed are subject to change without notice and may
differ or be contrary to the opinions or recommendations of UBS
Investment Research or the opinions expressed by other business areas
or groups of UBS as a result of using different assumptions and 
criteria. UBS may, as principal or agent, have position in, 
underwrite, buy or sell, make a market in, or enter into derivatives
transactions in relation to any financial instrument or asset 
referred to in this email. Unless stated specifically otherwise, this
is not a recommendation, offer or solicitation to buy or sell and any
prices or quotations contained herein are indicative only. UBS has
policies and procedures designed to minimise the risk that that
officers and employees are influenced by any conflicting interest or
duty and that confidential information is improperly disclosed or 
made available. To the extent permitted by law, UBS does not accept
any liability arising from the use of this communication. 
For additional information, please contact your local sales or 
trading contact. © 2005 UBS.  All rights reserved.
Intended for recipient only and not for further distribution 
without the consent of UBS.

Re: Oracle

2006-04-11 Thread Tim Gorman
Called "Oracle OLE DB"
(http://www.oracle.com/technology/tech/windows/ole_db/index.html), I
think...


on 4/11/06 5:02 PM, Ron Savage at [EMAIL PROTECTED] wrote:

> On Tue, 11 Apr 2006 12:58:23 -0400, Garrett, Philip \(MAN-Corporate\) wrote:
> 
> HI Philip
> 
>> * DBD::Proxy - requires another system that DOES have DBD::Oracle
>> (or, you could proxy through a Windows server that has an ADO
>> driver for Oracle)
> 
> I've never heard of an ADO driver for Oracle. What's the module called? And,
> where can I download a copy?
> 
> TIA.
> 
> --
> Cheers
> Ron Savage, [EMAIL PROTECTED] on 12/04/2006
> http://savage.net.au/index.html
> Let the record show: Microsoft is not an Australian company
> 
> 
> 
> 
> 



RE: Oracle

2006-04-11 Thread Ron Savage
On Tue, 11 Apr 2006 12:58:23 -0400, Garrett, Philip \(MAN-Corporate\) wrote:

HI Philip

> * DBD::Proxy - requires another system that DOES have DBD::Oracle
> (or, you could proxy through a Windows server that has an ADO
> driver for Oracle)

I've never heard of an ADO driver for Oracle. What's the module called? And,
where can I download a copy?

TIA.

--
Cheers
Ron Savage, [EMAIL PROTECTED] on 12/04/2006
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company




Re: DBD:Oracle

2006-04-11 Thread Scott T. Hildreth
On Tue, 2006-04-11 at 11:09 -0500, Maniace Libi - lmania wrote:
> I have a developer who wants DBD::ORACLE installed on a Solaris server.
> There is not an instance of
> 
> Oracle installed on this server. He is certain that it can be installed,
> but I can't find information supporting
> 
> this. It always errors out with wanting "Oracle_home". Is there a way to
> install DBD without oracle 

  You would need an Oracle Client installed, otherwise your developer
could use DBD::Proxy.  Setting up the Proxy server on the machine with 
the Oracle Server.

> 
> installed.
> 
>  
> 
> Thanks
> 
>  
> 
> Libi
> 
>  
> 
> ***
> The information contained in this communication is confidential, is
> intended only for the use of the recipient named above, and may be legally
> privileged.
> 
> If the reader of this message is not the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited.
> 
> If you have received this communication in error, please resend this
> communication to the sender and delete the original message or any copy
> of it from your computer system.
> 
> Thank You.
> 
-- 
Scott T. Hildreth <[EMAIL PROTECTED]>


RE: insertion through dbi

2006-04-11 Thread Baserdem, Mehmet
Hi all,

I guess I found the source of the problem. The new line chars at the end
was preventing the insertion at middle rows. 

Below code works fine.

Regards, 

Mehmet Baserdem




#!/usr/bin/perl 

use DBI; 
use DBD::DB2::Constants;
use DBD::DB2;

@IDS =();


# open file
open(FILE, "data.txt") or die("Unable to open file");

# read file into an array

while(){
chomp;
push(@IDS,$_);
}


# close file 
close(FILE);

print "size"[EMAIL PROTECTED];

# There are IDS to be INSERTED
$dbh = DBI->connect("dbi:DB2:USQLTST1", "USQLCD", "QUEEN"); 
$sth = $dbh->prepare("INSERT INTO MB_TEST_FOO VALUES (?)");
$sth->execute_array(\%attr, [EMAIL PROTECTED]); 
$sth->finish();
$dbh->disconnect();



 


Re: DBD:Oracle

2006-04-11 Thread John Scoles
You do not need an "Oracle Database" installed.

However,  you at least need an Oracle client installed on the same box. This
is the Oracle_home that DBD:Oracle wants.

Cheers

John Scoles


***
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.





Re: insertion through dbi

2006-04-11 Thread Tom Schindl
Baserdem, Mehmet wrote:
> Hi all,
> 
> I am trying to insert 16K records into some table through DBI. But my
> script only inserts the last record. I check the array size and the sql
> return values. Everything seems normal. Any ideas?
> 
> 
> Regards,
> 
> Mehmet Baserdem
> 
> 
> 
> Here is the my script:
> 
> 
> 
> #!/usr/bin/perl 
> 
> use DBI; 
> use DBD::DB2::Constants;
> use DBD::DB2;
> 
> @IDS =();
> 
> # open file
> open(FILE, "data.txt") or die("Unable to open file");
> 
> # read file into an array
> @IDS = ;
> 
> # close file 
> close(FILE);
> 
> #print "array size "[EMAIL PROTECTED];
> 
> # There are IDS to be INSERTED
> $dbh = DBI->connect("dbi:DB2:testdb", "testuser", "testpasswd");  
> $sth = $dbh->prepare("INSERT INTO mytable VALUES (?)");

According to the docs (man DBI) this is not a reference:
8<
$sth->execute_array(\%attr, @IDS);
8<

Buf i've never used it.

> $sth->execute_array(\%attr, [EMAIL PROTECTED]); 
> $sth->commit(); 
> $sth->finish();
> $dbh->disconnect();
> 
> 


Tom


RE: Oracle

2006-04-11 Thread Garrett, Philip \(MAN-Corporate\)
No, DBD::Oracle requires the Oracle client libraries to be installed.

There are other options, though, depending on your requirements:

  * DBD::Proxy - requires another system that DOES have DBD::Oracle (or,
you could proxy through a Windows server that has an ADO driver for
Oracle)
  * DBD::JDBC - In theory, can connect without the Oracle client if you
use Oracle's thin JDBC driver

Philip


-Original Message-
From: Maniace Libi - lmania [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 11, 2006 12:09 PM
To: dbi-users@perl.org
Subject: DBD:Oracle

I have a developer who wants DBD::ORACLE installed on a Solaris server.
There is not an instance of

Oracle installed on this server. He is certain that it can be installed,
but I can't find information supporting

this. It always errors out with wanting "Oracle_home". Is there a way to
install DBD without oracle 

installed.

 

Thanks

 

Libi

 


***
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be
legally privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.




insertion through dbi

2006-04-11 Thread Baserdem, Mehmet
Hi all,

I am trying to insert 16K records into some table through DBI. But my
script only inserts the last record. I check the array size and the sql
return values. Everything seems normal. Any ideas?


Regards,

Mehmet Baserdem



Here is the my script:



#!/usr/bin/perl 

use DBI; 
use DBD::DB2::Constants;
use DBD::DB2;

@IDS =();

# open file
open(FILE, "data.txt") or die("Unable to open file");

# read file into an array
@IDS = ;

# close file 
close(FILE);

#print "array size "[EMAIL PROTECTED];

# There are IDS to be INSERTED
$dbh = DBI->connect("dbi:DB2:testdb", "testuser", "testpasswd");
$sth = $dbh->prepare("INSERT INTO mytable VALUES (?)");
$sth->execute_array(\%attr, [EMAIL PROTECTED]); 
$sth->commit(); 
$sth->finish();
$dbh->disconnect();


DBD:Oracle

2006-04-11 Thread Maniace Libi - lmania
I have a developer who wants DBD::ORACLE installed on a Solaris server.
There is not an instance of

Oracle installed on this server. He is certain that it can be installed,
but I can't find information supporting

this. It always errors out with wanting "Oracle_home". Is there a way to
install DBD without oracle 

installed.

 

Thanks

 

Libi

 

***
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.



Re: Parse Excel repeats columns

2006-04-11 Thread Steffen Goeldner
Mary Anderson wrote:

> 
> >Hi All,
> I have picked up ParseExcel and started to work with it.  I am having 
> a problem with code that essentially looks like this:
> 
> for ($iR = 0; ($oWkS->{MaxRows} && $iR <=$oWkS->{MaxRows}, $iR++){
>for ($iC=0; ($oWkS->{MaxCols} && $iC <=$oWkS->{MaxRows}, $iC++){
>   $oWkC = $oWkS->{Cells}[$iR][$iC];
>MyString .= " $oWkC->Value;
>}
> }

Hmm, from an DBI users point of view, I'd try:

  use DBI();

  $dbh = DBI->connect('dbi:ODBC:driver=Microsoft Excel Driver 
(*.xls);dbq=test.xls;DriverID=790') or die $DBI::errstr;
  $sth = $dbh->prepare('select * from [Table1$]');
  $sth->execute;
  $sth->dump_results;


Steffen


Parse Excel repeats columns

2006-04-11 Thread Mary Anderson

>Hi All,
I have picked up ParseExcel and started to work with it.  I am having 
a problem with code that essentially looks like this:

for ($iR = 0; ($oWkS->{MaxRows} && $iR <=$oWkS->{MaxRows}, $iR++){
   for ($iC=0; ($oWkS->{MaxCols} && $iC <=$oWkS->{MaxRows}, $iC++){
  $oWkC = $oWkS->{Cells}[$iR][$iC];
   MyString .= " $oWkC->Value;
   }
}

The problem is that sometimes the value in the cell for a given $iC is 
repeated

 MyString = "Cell 1 Cell 2 Cell 2 Cell 3"
instead of
 MyString = "Cell 1 Cell 2 Cell 3"

It is an intermittant problem -- only one column, if that, on a worksheet 
will be affected.  And if I do more than one row, I see the same thing in 
each row.

I think it may have something to do with the formatting of the EXCEL 
spreadsheet.  The first time it happened, I went through an formatted all 
the columns with autofit to contents, and that seemed to take care of it.
This is the second time I am seeing it.  

I wonder if you have any experience with this.

Thanks,
Mary