Apache::Session::DBI and Oracle

2002-01-18 Thread Felipe Martínez Hermo


Hi, there. Hope this is not off-topic :)

I have been developing for a couple of months with DBI:Oracle against 
Oracle7.3 and now I need to use the features of Apache::Session::DBI. I have read the 
manpage and every page I found on Apache.org and Google, but the simplest sample code 
don't work.
I've been putting an eye on DBIStore.pm and it says:
To use this module, you will need these columns in a table
called 'sessions':

 id char(16)
 length int(11)
 a_session text

Where the a_session column needs to be able to handle arbitrarily
long binary data.


There is no such table in my Oracle database, but I don't think thats the problem, 
because it would say invalid table name instead of no statement parsed.


I'm using perl 5.005, DBI 1.13-3, DBD:Oracle 1.08 and Oracle 7.3.2

Here's my script:

#!/usr/bin/perl -w

use strict;
use Apache::Session::DBI;

my %session;
print Content-Type: text/html\n\n;
print HTMLBODY;
print h3Session example/h3;
tie %session, 'Apache::Session::DBI', undef, {DataSource = 'dbi:Oracle:mydb' , 
UserName = 'myuser' , Password = 'mypassword'};

$session{userid} = 'USER';
my $id = $session{_session_id};
print H3The session id is: $idH3;
print H3My user is: $session{userid}/H3;

print /BODY/HTML;
exit;

---

And here's what Apache's error.log says yo me:

[Fri Jan 18 09:34:20 2002] [error]  (in cleanup) DBD::Oracle::st execute failed: 
ORA-01003: no statement parsed (DBD ERROR: OCIStmtExecute) at 
/usr/lib/perl5/Apache/Session/DBIStore.pm line 143.

panic: POPSTACK
Callback called exit.




Thanks in advance

-- 

==
Felipe Martínez Hermo
[EMAIL PROTECTED]
[EMAIL PROTECTED]
==
Servicios Informáticos
UGT Galicia
[EMAIL PROTECTED]
==



DBD:Oracle Problem - Windows 98

2002-01-18 Thread Yegneshwar

Hi
It is something that is bugging me for a while.  I have installed DBI 
module and DBD-Oracle module, through
the ppm utility of ActiveState Perl for Win32.

But when I try to connect to the oracle server it gives the following error.
---
install_driver(Oracle) failed: Can't load 
'C:/Perl/site/lib/auto/DBD/Oracle/Orac
le.dll' for module DBD::Oracle: load_file:One of the library files needed 
to run
  this application cannot be found at C:/Perl/lib/DynaLoader.pm line 206.
  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
  at a1.pl line 5
---
The installation of the modules were fine, and I'm able to connect through 
sqlplus.
I'm not sure what is causing this problem.

Any help will be highly appreciated.

Thanks,
Yegi




About fetchrow_array

2002-01-18 Thread Ida Sze

Dear Sir/Madam,

I have the following coding:

line 70:  my $sth=$dbh-do(select * from temp where
ID = '$Staff_ID' and Date = '$Date' and Time !=
'$Time' order by Time desc);

line 71:  while(my @Data=$sth-fetchrow_array) {
..
}

but when i run it, the following error message was
displayed:

Can't call method fetchrow_array without a package
or subject reference at of.pl line 71, INPUT line 1.

Can you help me to solve this problem.

Thanks

Best Regards,

Ida


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/



DBD::Oracle 1.12 on Irix 64 fails with ld64 error

2002-01-18 Thread Ken Ortiz

Hello all,
This is just a note for those of you who may have had problems
installing DBD::Oracle 1.12 onto Irix-64 using a 64 bit perl, in my case
perl v5.6.1.  Although there's plenty of useful mail in this archive
about Irix - DBI/DBD problems, there were no solutions for this specific
problem.

When I built the makefile with perl5 Makefile.PL, it seemed to build
fine, however, the 'make' phase continually failed during linking with
the following error:

ld64: FATAL 9: I/O error (echo): No such file or directory
*** Error code 2 (bu21)

Here's what finally worked for me.  I rebuilt the makefile with  the
following command:
perl5 Makefile.PL -nob
and then I was able to finish the installation and successfully test.
This is one of the recommendations found in the README.help file of the
DBD documentation.

Ken Ortiz
Sysadmin - NOAA




Re: Fw: RE: MS Access file - accessing from Linux?

2002-01-18 Thread Nick Gorham

About-tw.com §K¶O¤H¤O»È¦æ wrote:

 You should use the openlink sdk connect to windows.Use the Multi-tie version of 
oprnlink software and SDK.

 Download the l3br.taz ,l3ko.taz ,l3kuz.taz ,l3oc.taz and install.sh 
for linux.And remeber setup the $ENV before you make.

 Download the ntbr.zip for windows. On windows,you should install the MSDE to 
transfer the access(*.mdb) to MS-SQL .Then configure the ODBC DSN .

 I just do it by this way. But the problem is I can't directly connect to the access 
database via DBD-ODBC from linux .It need to transfer to MS-SQL style.

 Hope this will help you a little bit. If you find out the other way to connect 
access database, please let me know.

 Regards,
 Tom Wu
 [EMAIL PROTECTED]


As someone else has mentioned a commercial solution our (Easysoft) ODBC-ODBC bridge 
will allow you to connect to the access ODBC driver and from there to the
..mdb.

This does require the mdb to be on a windows box, no one has a full spec for the mdb 
files, so  a direct driver is not possible at the moment.

--
Nick Gorham
Easysoft Ltd






Re: About fetchrow_array

2002-01-18 Thread Ronald J Kimball

On Wed, Jan 16, 2002 at 11:54:27PM -0800, Ida Sze wrote:
 Dear Sir/Madam,
 
 I have the following coding:
 
 line 70:  my $sth=$dbh-do(select * from temp where
 ID = '$Staff_ID' and Date = '$Date' and Time !=
 '$Time' order by Time desc);
 
 line 71:  while(my @Data=$sth-fetchrow_array) {
 ..
 }
 
 but when i run it, the following error message was
 displayed:
 
 Can't call method fetchrow_array without a package
 or subject reference at of.pl line 71, INPUT line 1.

Please refer to the docs for DBI:

   do
 
 $rc  = $dbh-do($statement)   || die $dbh-errstr;
 $rc  = $dbh-do($statement, \%attr)   || die $dbh-errstr;
 $rv  = $dbh-do($statement, \%attr, @bind_values) || ...
 
   Prepare and execute a single statement. Returns the
   number of rows affected or undef on error. A return
   value of -1 means the number of rows is not known or
   is not available.
 
   This method is typically most useful for non-SELECT
   statements that either cannot be prepared in advance
   (due to a limitation of the driver) or do not need to
   be executed repeatedly. It should not be used for
   SELECT statements because it does not return a
   statement handle (so you can't fetch any data).


Ronald



Re: ANNOUNCE: SQL::Statement 1.0, pure perl, join-enabled

2002-01-18 Thread Mr. Sunblade

Jeff Zucker wrote:

As always, for large apps where
speed is critical, users are better off with a real rdbms.

For large apps where speed is critical, consider a vector based solution
instead.

Regards,

Mr. Sunblade




Got a queston about OTHERLDFLAGS

2002-01-18 Thread Jay Strauss

In the README.hpux doc it says:
---
In my case, LhtStrInsert was undefined.  To solve this problem, I had
to looked though the Oracle libraries using nm.  I found the symbol
in 3 separate libraries in $ORACLE_HOME/lib.  I then proceeded to as these
libraries to the OTHERLDFLAGS makefile macro until I got a clean linke.
libqsmashr.sl was what did the trick for me.
---

How do I go about modifing the OTHERLDFLAGS??? is the an environmental
variable, a command line argument to perl Makefile.PL, do I edit the
Makefile?  As you can see above the doc hints but doesn't tell.

Could someone explain

Thanks
Jay




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: Got a queston about OTHERLDFLAGS

2002-01-18 Thread John D Groenveld

Seems like you should be able to do...
env LDFLAGS=-L/path/to/lib -R/path/to/lib -lfoo perl Makefile.PL and
have it set OTHERLDFLAGS in Makefile to yours.

But of course I always get sea sick when I look at Makefile.PL.
John
[EMAIL PROTECTED]




How to use bind

2002-01-18 Thread Morrison Davis

Hi ALL,

  Fairly new to DBI but have managed to get an oracle 9.0.1 
data base up and running and a web application to access it.
I use:
my $STATEMENT2 = Insert into REPLIES values(
reply_id.nextval,
\'$REPLY\',
\'$myform{employee_id}\',sysdate,thread_id.currval,
\'$myform{toolid}\',\'$myform{iconid}\',\'$myform{category_id}\');

$stmt2 = $dbh-prepare($STATEMENT2);
$stmt2-execute() or die $DBI::errstr;

the problem is $REPLY can hold upto 4000 characters. And today I got my first
error string literal too long ora-1704 says to use bind variables.

How would I use bind variables to do this same command. And where is a good place
to readup on how to use DBI bind param.
  
Thanks Morry
e-mail address: [EMAIL PROTECTED]
phone: X84792/650 786-4792 fax 650 562-2143




Re: inserting CGI-data into mysql-DB style question

2002-01-18 Thread Michael A Chase

Something very similar came up a couple days ago.  See the attached email.
-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.
- Original Message - 
From: Moritz von Schweinitz [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 18, 2002 14:35
Subject: inserting CGI-data into mysql-DB style question


 sorry if this is a banal question, but my brain just got sick and tired
 of
 
 $dbh-do(INSERT INTO tablename
 (
 firstname,
 surname,
 bla3,
 bla4,
 bla5,
 bla6
 )
 VALUES
 (
 ?,
 ?,
 ?,
 ?,
 ?,
 ?
 )
 , undef, $in{firstname}, $in{surname}, $in{bla3}, [and
 so on]);
 
 is there a nice way to qoute the contents of my %in, and insert them
 without always having to count question-marks, and watching out that the
 right hash-element maps to the right question-mark, which in turn maps
 to the correct column?
 
 all the nice bind-functions don't seem to make life easier in this
 aspect.
 
 am i missing some basic (my)SQL/DBI-command or something?
 
 *confused*
 
 M.
 
 
 
 
 

---BeginMessage---

You need to start a little earlier.  Build the SQL so it has the desired
number of placeholders.

# The default error message is more thorough that your die()
$dbh - {RaiseErrors} = 1;

# Assuming @names has the correct number of values
my ( @where, @vals );
foreach ( @names ) {
   push @where, name = ?;
   push @vals, %$_%;
}
my $sql = SELECT * FROM my_table;
$sql .= WHERE  . join(  AND , @where ) if @where;
my $sth = $dbh - prepare( $sql );
$sth - execute( @vals );

# This will generate a brand new SQL statement every time.
# In Oracle, the parser will recognize when you use the identical text
# and use the previously parsed statement.

--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.
- Original Message -
From: Tony Vassilev [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 04:54
Subject: arbitrary number of bindings  LIKE statement


 I'm a newbie trying to get a grip on the bind_param function:

 If I'm trying to execute an SQL LIKE statement with several
placeholders,
 the following method of binding works (I get the proper data returned):

  my $sth = $dbh-prepare($sql) || die couldn't prepate;
  $sth-bind_param(1, %$names[0]%);
  $sth-bind_param(2, %$names[1]%);
  $sth-execute() || die error couldn't execute;

 That method of course requires that I know the number of bindings
ocurring.
 For an arbitrary number, I've been trying this:

  my $sth = $dbh-prepare($sql) || die couldn't prepate;
  foreach $x (0..$#names) {
 $sth-bind_param($x+1, %$names[$x]%);
   }
  $sth-execute || die error couldn't execute;

 And yet, fetching the results of this one returns only comparisons with
the
 last binding.  So, in a case with two names, only data mathing LIKE
 %$names[1]% comes back while the first one is not compared.

 I don't understand...  I mean, aren't those two methods effectively asking
 for the same thing?  I've been fooling around for a while trying to find a
 way to execute a LIKE statement with an arbitrary number of placeholders
but
 keep running into stumbling blocks with the DBI syntax.

 Any help would be great!  I imagine this is a very simple problem.




---End Message---


RE: inserting CGI-data into mysql-DB style question

2002-01-18 Thread Moritz von Schweinitz

yep.
i had a function like this myself once, but i was just wondering whether
there's a way to tell the DBI to insert a row from a given hash,
interpreting the keys as column-names, and preferably ignoring keys that
don't appear in the DB as columnsomething like an inversed
fetchrow_hashref, i guess (insertrow_hashref ?).

shouldn't be too hard to code, but if it's already out there, that'd be
cool

anybody?

M.

 -Original Message-
 From: Michael A Chase [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 18, 2002 5:33 PM
 To: Moritz von Schweinitz; [EMAIL PROTECTED]
 Subject: Re: inserting CGI-data into mysql-DB style question
 
 
 Something very similar came up a couple days ago.  See the 
 attached email.
 -- 
 Mac :})
 ** I normally forward private questions to the appropriate 
 mail list. **
 Give a hobbit a fish and he eats fish for a day.
 Give a hobbit a ring and he eats fish for an age.
 - Original Message - 
 From: Moritz von Schweinitz [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, January 18, 2002 14:35
 Subject: inserting CGI-data into mysql-DB style question
 
 
  sorry if this is a banal question, but my brain just got 
 sick and tired
  of
  
  $dbh-do(INSERT INTO tablename
  (
  firstname,
  surname,
  bla3,
  bla4,
  bla5,
  bla6
  )
  VALUES
  (
  ?,
  ?,
  ?,
  ?,
  ?,
  ?
  )
  , undef, $in{firstname}, $in{surname}, $in{bla3}, [and
  so on]);
  
  is there a nice way to qoute the contents of my %in, and insert them
  without always having to count question-marks, and watching 
 out that the
  right hash-element maps to the right question-mark, which 
 in turn maps
  to the correct column?
  
  all the nice bind-functions don't seem to make life easier in this
  aspect.
  
  am i missing some basic (my)SQL/DBI-command or something?
  
  *confused*
  
  M.
  
  
  
  
  
 




FW: CPAN Upload: J/JU/JURL/DBD-ODBC-0.31.tar.gz

2002-01-18 Thread Jeff Urlwin

Two new updates:
Build directly against SAP db 
Ping fix for Oracle 8.  Please let me know if this causes a problem elswehere.

Thanks,

Jeff

-Original Message-
From: PAUSE [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 18, 2002 6:49 PM
To: Jeff Urlwin; [EMAIL PROTECTED]
Subject: CPAN Upload: J/JU/JURL/DBD-ODBC-0.31.tar.gz


The uploaded file

DBD-ODBC-0.31.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/J/JU/JURL/DBD-ODBC-0.31.tar.gz
  size: 219427 bytes
   md5: 5203b9a404f75f745b320d4a2e57f2ad

No action is required on your part
Request entered by: JURL (Jeff Urlwin)
Request entered on: Fri, 18 Jan 2002 23:48:16 GMT
Request completed:  Fri, 18 Jan 2002 23:48:50 GMT

Virtually Yours,
Id: paused,v 1.74 2001/05/20 14:59:52 k Exp k 




RE: How to use bind

2002-01-18 Thread Sterin, Ilya

my $sth = $dbh-prepare(select foo1, foo2 from bar where a = ? and b = ?);
$sth-execute($a_val, $b_val);

You can also use bind_param()

Please read docs (perldoc DBI).  It is documented there very well.

Ilya

-Original Message-
From: Morrison Davis
To: [EMAIL PROTECTED]
Sent: 1/18/02 4:34 PM
Subject: How to use bind

Hi ALL,

  Fairly new to DBI but have managed to get an oracle 9.0.1 
data base up and running and a web application to access it.
I use:
my $STATEMENT2 = Insert into REPLIES values(
reply_id.nextval,
\'$REPLY\',
\'$myform{employee_id}\',sysdate,thread_id.currval,
\'$myform{toolid}\',\'$myform{iconid}\',\'$myform{category_id}\');

$stmt2 = $dbh-prepare($STATEMENT2);
$stmt2-execute() or die $DBI::errstr;

the problem is $REPLY can hold upto 4000 characters. And today I got my
first
error string literal too long ora-1704 says to use bind variables.

How would I use bind variables to do this same command. And where is a
good place
to readup on how to use DBI bind param.
  
Thanks Morry
e-mail address: [EMAIL PROTECTED]
phone: X84792/650 786-4792 fax 650 562-2143



RE: DBI value assigning Question?

2002-01-18 Thread Sterin, Ilya

This is a matter of knowing how to use hash references, since this is what's
being returned.  Read perldoc perlref for more info.

Hint...

$hash_ref-{key} (- dereferences)

Ilya

-Original Message-
From: Murali Kanaga
To: '[EMAIL PROTECTED]'
Sent: 1/18/02 6:12 PM
Subject: DBI value assigning Question?


Hi Perl DBI Gurus,

Greetings!

This script is being executed on Solaris. It does connect to an MS SQL
via
DBD::Proxyserver.

1.  This script prompt the user for a bug-nmber($bfn)

2.  Checks the SQL db whether the status ($release_status)
is 
Assigned and for the release ($releasae_ID)
 
3.  The question is after the while statement: between the
** lines

any pointers, help would be very much appreciated.

Thanks,
-Murali

Here is the perl script:

# morpheus{root}151: cat trig2.pl
use strict;
use DBI;
use Data::Dumper;

#Defined variable
my $rel_branch = 6.0.0;

# DB Source Connection
..
$dbh = DBI-connect( dbi:Proxy:$proxy;dsn=$dsn, 'reports',
'reports' ) or die Can't   connect to db: $DBI::errstr\n;
...

# User Prompt
my $bfn = 'Enter the Bug-fix Number');

#SQL Statement

my $sth = $dbh-prepare( SELECT p.k_productreview,
q1.s_qualmeasure
as version, q2.s_qualmeasure as status  );

$sth-execute($bfn);

while( $row = $sth-fetchrow_hashref) {
print Dumper($row);



*
QUESTION:

1.  How can I assign the the SQL executed output
results(ROWS)
into a variable
for e.g:

$release_ID = DONT KNOW HOW TO DO {version};

$release_status = DONT KNOW HOW TO DO {status};

So that I can have the following Logic:

if (($release_ID =~ /6.0./)  ($release_status =~ /Assigned/)){


*

# Here is the ou put of the scriot:

morpheus{root}152:perl -w trig2.pl
$VAR1 = {
  'status' = 'Closed - Fixed',
  'k_productreview' = '2345',
  'version' = '0.0.0'
};