Oracle behaviour when inserting strings containing only blanks

2001-04-30 Thread Fox, Michael

I see this has come up before, but looking at the archives it does not seem
to have been properly resolved.

Inserting a string containing only blanks  into a NOT NULL column gives an
error, as in the example (note: the third insert is actually trying to
insert a single space character):

#!/u02/devel/bin/perl -w
#
use DBI;

my $db_user='';
my $db_name='dwht01';
my $db_type='Oracle';

my $dbh=DBI->connect("dbi:$db_type:$db_name", $db_user, $db_user,
 {AutoCommit => 0, PrintError => 0})
 || die "Cannot connect to $db_name: $DBI::errstr";

# create table with a null col
$dbh->do('DROP TABLE xyzzy')
 || warn "cannot drop table $DBI::errstr\n";
$dbh->do('CREATE TABLE xyzzy(a varchar(10) null, b varchar2(10) not null)')
 || die "cannot create table $DBI::errstr\n";

my $sql="INSERT INTO xyzzy(a,b) VALUES(?,?)";
my $sth=$dbh->prepare($sql)
 || die "cannot prepare $sql $DBI::errstr\n";

# normal insert
$sth->execute('1','a')
 || warn "cannot insert ['1','a'] $DBI::errstr\n";
# null insert
$sth->execute('2',undef)
 || warn "cannot insert ['2',undef] $DBI::errstr\n";
# blank insert
$sth->execute('3',' ')
 || warn "cannot insert ['3',' '] $DBI::errstr\n";

$sth->finish;

$sql="INSERT INTO xyzzy(a,b) VALUES(5,' ')";
$sth=$dbh->prepare($sql)
 || die "cannot prepare $sql $DBI::errstr\n";
$sth->execute
 || warn "cannot insert ['5',' '] $DBI::errstr\n";
$sth->finish;

$sql='SELECT * FROM xyzzy';
$sth=$dbh->prepare($sql)
 || die "cannot prepare $sql $DBI::errstr\n";
$sth->execute;
$sth->dump_results;
$sth->finish;

$dbh->commit;
$dbh->do('DROP TABLE xyzzy')
 || die "cannot drop table $DBI::errstr\n";
$dbh->disconnect;

which gives

cannot drop table ORA-00942: table or view does not exist (DBD ERROR:
OCIStmtExecute)
cannot insert ['2',undef] ORA-01400: cannot insert NULL into
("FOXM"."XYZZY"."B") (DBD ERROR: OCIStmtExecute)
cannot insert ['3',' '] ORA-01400: cannot insert NULL into
("FOXM"."XYZZY"."B") (DBD ERROR: OCIStmtExecute)
'1', 'a'
'5', ' '
2 rows

 ie the 3rd insert unexpectedly fails

The platform is alpha OSF1, DBI 1.15 and DBD-Oracle 1.06, Oracle 8.0.4

Finally reading the Changes file, I found the database handle attribute
ora_ph_type, which sets the default binding (plus a request for testing
it!); I tried setting it to STRING with 

 {AutoCommit => 0, PrintError => 0, ora_ph_type => 5})

with no luck.  I then tried CHAR using 

 {AutoCommit => 0, PrintError => 0, ora_ph_type => 96})

and it inserted correctly, producing:

cannot drop table ORA-00942: table or view does not exist (DBD ERROR:
OCIStmtExecute)
cannot insert ['2',undef] ORA-01400: cannot insert NULL into
("FOXM"."XYZZY"."B") (DBD ERROR: OCIStmtExecute)
'1', 'a'
'3', ' '
'5', ' '
3 rows

>From the documentation, I thing the STRING type should have worked.
Hopefully using CHAR will not create other side effects, although it has
correctly inserted a single space into a VARCHAR2(10) column in this
example.

Michael Fox
Australia Post


CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.



Re: Easiest way to tell if a table already exists?

2001-04-30 Thread Michael A. Chase

Unless you do something to force it, Oracle doesn't actually describe the
statement (fetch table and column information from the database) until
execute() time.  Then it also normally fetches the first buffer full of rows
which can be very expensive for large tables.

A "SELECT * FROM table" may be the easiest way to test for a table's
existence, but it's much safer and probably cheaper to check the data
dictionary of whatever database you are using.  I'd at least add a WHERE
clause that guarantees no rows get fetched like 'WHERE 1 = 2'.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Neil Lunn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 5:33 PM
Subject: RE: Easiest way to tell if a table already exists?


> > -Original Message-
> > From: PD Miller [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, April 30, 2001 6:31 PM
> > To: Sterin, Ilya; Mike Schienle; [EMAIL PROTECTED]
> > Subject: RE: Easiest way to tell if a table already exists?
> >
> >
> > At 21:56 -0400 25/4/01, Sterin, Ilya wrote:
> > >Why would (select * from foo) take up lost of resources?
> > Won't it just
> > >place the cursor at the first row and only return when rows
> > are fetched?
> >
> > Speaking for Oracle, as soon as the statement is executed (and before
> > any fetch) Oracle will execute the statement - and that means
> > performing the full table scan(s) or index scan(s) necessary to
> > fulfill the statement.
>
> You missed the point. This all happens at the prepare with little cost.
That
> is what prepare is for.





RE: Easiest way to tell if a table already exists?

2001-04-30 Thread Neil Lunn

> -Original Message-
> From: PD Miller [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 30, 2001 6:31 PM
> To: Sterin, Ilya; Mike Schienle; [EMAIL PROTECTED]
> Subject: RE: Easiest way to tell if a table already exists?
> 
> 
> At 21:56 -0400 25/4/01, Sterin, Ilya wrote:
> >Why would (select * from foo) take up lost of resources?  
> Won't it just
> >place the cursor at the first row and only return when rows 
> are fetched?
> 
> Speaking for Oracle, as soon as the statement is executed (and before 
> any fetch) Oracle will execute the statement - and that means 
> performing the full table scan(s) or index scan(s) necessary to 
> fulfill the statement.

You missed the point. This all happens at the prepare with little cost. That
is what prepare is for.

Neil

__
Please Note :
Only  the intended recipient is authorised to access or use this e-mail.  If
you are not the intended recipient,
please delete this e-mail and notify the sender immediately.   The contents
of this e-mail are the writer's 
opinion and are not necessarily endorsed by the Gunz Companies unless
expressly stated.

We use virus scanning software but exclude all liability for viruses or
similar in any attachment.





RE: array ref of statement handles

2001-04-30 Thread Sterin, Ilya

The exception is thrown on execute() so we would need to see just a little
bit more code, also trace() helps a lot, but in this situtation I think it's
something simple, like not dereferencin right, etc...

Ilya Sterin

-Original Message-
From: John Saylor [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 4:55 PM
To: [EMAIL PROTECTED]
Subject: array ref of statement handles


Hi

I thought it would be nice to keep statement handles in an array ref.
Something like this:

$sth->[0] = $dbh->prepare ( $sql->[0] );
$sth->[1] = $dbh->prepare ( $sql->[1] );

But it's not working. When I try to execute I get this:
Can't call method "execute" on unblessed reference

So I'm guessing that I can't just shove statement handles onto an array
ref [although maybe push would work better ...].

Any suggestions or comments are welcome.

--
\js

There's more than one way to skin a cat:
Way #15 -- Krazy Glue and a toothbrush.
Way #27 -- Use an electric sander.
Way #32 -- Wrap it around a lonely frat man's pecker.
Way #33 -- A bicycle pump.



Re: (Fwd) Further Oracle Character Set Issues

2001-04-30 Thread Mark Vandenbroeck

Andy, 

Can you check what got into the database ? You can do a :
SELECT .. DUMP(column, 16) FROM ...
This will give you a hex dump of the physical contents of the column.

If you have your NLS_LANG and the database both using the same characterset, then 
Oracle will pass on all characters untranslated. This is the so even if the 
characterset is 7 bit and the characters have the 8th bit set !

So, your problem must come from elsewhere, not from Oracle. It couldn't be simply a 
display problem ? Like if you use a terminal emulator configured for 7 bit and 
stripping the 8th ? I have seen that happen before.

Brgds,

Mark


- Original Message - 
From: "Tim Bunce" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 11:52 PM
Subject: (Fwd) Further Oracle Character Set Issues


> - Forwarded message from Andy Brick <[EMAIL PROTECTED]> -
> 
> From: Andy Brick <[EMAIL PROTECTED]>
> To: Tim Bunce <[EMAIL PROTECTED]>
> Subject: Further Oracle Character Set Issues
> Date: Mon, 30 Apr 2001 22:42:05 +0100
> In-Reply-To: <[EMAIL PROTECTED]>
> 
> Hi
> 
> I have my Perl script working fine on NT and Oracle 8.1.5-ish now.
> International characters from ISO8859-1 work fine, and I'm translating the
> extra Window 1252 characters without a hitch.
> 
> However, on Linux, with the same script, same data and same database, the
> eighth/top bit of each character gets reset and lost in Oracle. Oracle is
> using WE8ISO8859P1 for both NLS character sets, and the fact that the file
> is Code Page 1252 encoded shouldn't be an issue - the extra 1252 characters
> are translated by the Perl and the rest is compatible with WE8ISO8859P1 -
> plus it works on NT.
> 
> I've dumped the hex of the string I am passing to Oracle and it has the
> eighth bit there, with no hassles.
> 
> Am I missing something here ?
> 
> Any and all help greatly appreciated !!
> 
> Andy Brick
> [EMAIL PROTECTED]
> 
> - End forwarded message -
> 



Re: array ref of statement handles

2001-04-30 Thread Michael A. Chase

Those snippets all by themselves look innocuous enough, but I don't see any
error checking.  The prepare()s might be failing.  If you don't have
$dbh->{RaiseErrors} set, add 'or die "Prepare xxx failed, $DBI::errstr\n"'
to each prepare() call.

If you do have error checking on, I'd like to see the execute() calls.
There may be something about them that is causing the problem.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "John Saylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 1:54 PM
Subject: array ref of statement handles


> I thought it would be nice to keep statement handles in an array ref.
> Something like this:
>
> $sth->[0] = $dbh->prepare ( $sql->[0] );
> $sth->[1] = $dbh->prepare ( $sql->[1] );
>
> But it's not working. When I try to execute I get this:
> Can't call method "execute" on unblessed reference
>
> So I'm guessing that I can't just shove statement handles onto an array
> ref [although maybe push would work better ...].





RE: DBI::Pg Question

2001-04-30 Thread J. Patrick Lanigan

This isn't the first time I've tried this. Of course you were right and it
works now, but I doubt that the other times that I have tried it it was a
typo. Anyway use strict it is from now on.

Thanks,
Patrick

> On Mon, Apr 30, 2001 at 05:32:48PM -0500, J. Patrick Lanigan wrote:
> > I have the following lines in my script...
> >
> > Line #10> $mybd='test';
> >
> > Line #22> my $dbh = DBI->connect("DBI:Pg:dbname=$mydb") || die "Can't
> > connect to $data_source: $DBI::errstr";
>
> If you would `use strict` like perl's Fine Manual recommends, you
> would have
> caught the typo on line 10 a long time ago.




Re: DBI::Pg Question

2001-04-30 Thread Stephen Clouse

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Apr 30, 2001 at 05:32:48PM -0500, J. Patrick Lanigan wrote:
> I have the following lines in my script...
> 
> Line #10> $mybd='test';
> 
> Line #22> my $dbh = DBI->connect("DBI:Pg:dbname=$mydb") || die "Can't
> connect to $data_source: $DBI::errstr";

If you would `use strict` like perl's Fine Manual recommends, you would have
caught the typo on line 10 a long time ago.

- -- 
Stephen Clouse <[EMAIL PROTECTED]>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. 

-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQA/AwUBOu3nVAOGqGs0PadnEQJWXwCg6j7/e0Vu52G46RrdrvebvZIu2GEAoLuy
LSqVaHggA8jd1X/3upA3/3Wt
=44Ns
-END PGP SIGNATURE-



DBI::Pg Question

2001-04-30 Thread J. Patrick Lanigan

I have the following lines in my script...

Line #10> $mybd='test';

Line #22> my $dbh = DBI->connect("DBI:Pg:dbname=$mydb") || die "Can't
connect to $data_source: $DBI::errstr";

...and I am getting the following error...

DBI->connect(dbname=) failed: FATAL 1:  at test2.pl line 22
Can't connect to : FATAL 1:  at test2.pl line 22.

I have tried many different methods of addressing this issues, and yes it
works if I put the name directly in the DBI->connect call. How can I use a
variable to set the database name for which I need to establish a
connection.

Thanks,
Patrick




array ref of statement handles

2001-04-30 Thread John Saylor

Hi

I thought it would be nice to keep statement handles in an array ref.
Something like this:

$sth->[0] = $dbh->prepare ( $sql->[0] );
$sth->[1] = $dbh->prepare ( $sql->[1] );

But it's not working. When I try to execute I get this:
Can't call method "execute" on unblessed reference

So I'm guessing that I can't just shove statement handles onto an array
ref [although maybe push would work better ...].

Any suggestions or comments are welcome.

-- 
\js

There's more than one way to skin a cat:
Way #15 -- Krazy Glue and a toothbrush.
Way #27 -- Use an electric sander.
Way #32 -- Wrap it around a lonely frat man's pecker.
Way #33 -- A bicycle pump.



(Fwd) Further Oracle Character Set Issues

2001-04-30 Thread Tim Bunce

- Forwarded message from Andy Brick <[EMAIL PROTECTED]> -

From: Andy Brick <[EMAIL PROTECTED]>
To: Tim Bunce <[EMAIL PROTECTED]>
Subject: Further Oracle Character Set Issues
Date: Mon, 30 Apr 2001 22:42:05 +0100
In-Reply-To: <[EMAIL PROTECTED]>

Hi

I have my Perl script working fine on NT and Oracle 8.1.5-ish now.
International characters from ISO8859-1 work fine, and I'm translating the
extra Window 1252 characters without a hitch.

However, on Linux, with the same script, same data and same database, the
eighth/top bit of each character gets reset and lost in Oracle. Oracle is
using WE8ISO8859P1 for both NLS character sets, and the fact that the file
is Code Page 1252 encoded shouldn't be an issue - the extra 1252 characters
are translated by the Perl and the rest is compatible with WE8ISO8859P1 -
plus it works on NT.

I've dumped the hex of the string I am passing to Oracle and it has the
eighth bit there, with no hassles.

Am I missing something here ?

Any and all help greatly appreciated !!

Andy Brick
[EMAIL PROTECTED]

- End forwarded message -



Re: OFF_TOPIC: execute a perl script from within an asp page

2001-04-30 Thread Tim Bunce

On Mon, Apr 30, 2001 at 10:34:49AM -0600, Sterin, Ilya wrote:
> You are right Michael.  I noticed that by being nice and answering their
> question and then directing them to the right group, they come back with the
> same line...

Yeap. Thing to do is _politely_ tell them where to go, but don't actually
answer the question.

> I know this is off topic, but
> 
> Let's try to keep this list clean, it's probably cleaner than any other list
> out there and we have really good people here contributing.

Including you two guys - for which I'm hugely grateful.

Tim.



ERROR while executing a DBI script

2001-04-30 Thread Theja Rajakumar - Contractor

I'm getting the following error when I run the below code snippet.  Any
ideas what's wrong?

Error is :
Out of memory during "large" request for 4198400 bytes, total sbrk() is
13050512 bytes at /starfish/oracle/Apache/Apache/cgi-bin/validate2.pl
line 47.


34  my @domains = ();
35  my @row = ();
36
37  my $dbh =
DBI->connect("dbi:Oracle:sid=lang1;host=starfish.protocol.
com", "oracle", "oracle",
38  {AutoCommit => 1}) || die $DBI::errstr;
39
40  # get the domains for the selected tag
41  my $sth = $dbh->prepare("
42  select tag from tag
43  ") || die $dbh->errstr;
44
45  $sth->execute || die $dbh->errstr;
46  while ((@row = $sth=>fetchrow_array)) {
47  push @domains, $row[0];
48  }
49  $sth=>finish;





Re: [unixODBC-DEV] - DBI::ODBC unixODBC timestamp problem

2001-04-30 Thread Nick Gorham

[EMAIL PROTECTED] wrote:

> denblueuser@dbi:ODBC:SYBTEST> select VALUE_DATE from TRADE_BASIC/
> VALUE_DATE
> '2001-01-02 00:00:00.00.'
> [snip]
>
> When I looked with the perl debugger the final chars were \c@.
>
> Has anyone else come across this? Is there a work around?

Could you provide a ODBC trace of whats going on, I am tempted to suggest
it is a driver issue, the driver manager doesn't involve itself with data
returned from the driver, but the trace would help verify just what is
going wrong.

--
Nick Gorham
Easysoft Ltd






RE: OFF_TOPIC: execute a perl script from within an asp page

2001-04-30 Thread Sterin, Ilya

You are right Michael.  I noticed that by being nice and answering their
question and then directing them to the right group, they come back with the
same line...

I know this is off topic, but

Let's try to keep this list clean, it's probably cleaner than any other list
out there and we have really good people here contributing.

Ilya Sterin

-Original Message-
From: Michael A. Chase
To: Judge Dredd
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 04/30/2001 9:50 AM
Subject: OFF_TOPIC: execute a perl script from within an asp page

Please stop asking off topic questions on this list.  Even if you have a
database question, it does not belong in dbi-dev unless you are
contributing
to the development of the DBI layer or a database driver.

ASP questions belong on a CGI list.  I think there is one at
ActiveState,
but it is certainly not perl-win32-database.

Everyone, please ignore any more off-topic messages on these lists.  We
all
get enough email already without encouraging them.
--
Mac :})
** I normally forward private database questions to the DBI mail lists.
**
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Judge Dredd" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 4:42 AM
Subject: RE: execute a perl script from within an asp page


>
> No. I've already tried this and it's working, but to
> no use. What I want to do is execute (e.g. script.pl)
> from within an asp page, as if it was a binary .cgi.
>
>
>
> --- Andrew Finkenstadt <[EMAIL PROTECTED]> wrote:
> > Do you have access to PerlScript?
> >
> > 
> >
> > use strict;
> > my $q = "Hello there!";
> > print $q;
> >  
> >
> > no?
> >
> >
> > -Original Message-
> > From: Judge Dredd [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, April 29, 2001 8:18 PM
> > To: [EMAIL PROTECTED];
> > [EMAIL PROTECTED];
> > [EMAIL PROTECTED]
> > Subject: execute a perl script from within an asp
> > page
> >
> >
> > Thanks for all the responses on my previous
> > question.
> > Apart from that, do you know of a way i could
> > execute a perl script from
> > within an asp page in IIS 5.0?
> >
> > Thanks again
> > The Judge
> >
> >
> >
> _
> > Do You Yahoo!?
> > Get your free @yahoo.com address at
> > http://mail.yahoo.com
> >
>
>
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>



DBI::ODBC unixODBC timestamp problem

2001-04-30 Thread Alex Hornby


Hi,

I'm having trouble when using DBD::ODBC to query TIMESTAMP(nee
datetime) columns from a Sybase database using unixODBC. It looks like
the string it gets sprintf'ed to is the wrong size as I get random
junk on the end of the time value.

I'm using the Openlink 3.2MT drivers which provide good timestamp
values when used with unixODBC from C/C++.

Heres an example with dbish:

denblueuser@dbi:ODBC:SYBTEST> select VALUE_DATE from TRADE_BASIC/
VALUE_DATE
'2001-01-02 00:00:00.00.'
[snip] 

When I looked with the perl debugger the final chars were \c@.

Has anyone else come across this? Is there a work around? 

TIA,
Alex.



Re: DBD-Oracle

2001-04-30 Thread Michael A. Chase

The LD_LIBRARY_PATH looks bigger than it needs to be.  Normally the Perl
interpreter knows where to find the shared libraries in its library tree.

If you add all those directories (including $ORACLE_HOME/lib) inside the
script, the Sun dynamic loader may not be aware of them.  LD_LIBRARY_PATH
(and probably SHLIB_PATH) _really_ needs to be set before perl starts.  If
you can't get the webmaster to put the necessary directories in the variable
for you, you may need to set it in a wrapper script that calls your perl
program.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Antonio Hernández" <[EMAIL PROTECTED]>
To: "'Michael A. Chase'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 6:27 AM
Subject: RE: DBD-Oracle


> I have probe this, and the result is ok, in web browser I can see all vars
> allright,
>
> # Cargamos las variables de entorno del profile del usuario UNIX
> $ENV{'ORACLE_HOME'}='/opt/oracle/product/8.0.6';
> $ENV{'ORACLE_SID'}='RUMBO';
>
$ENV{'LD_LIBRARY_PATH'}='/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/D
> BI:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBD
>
:/usr/local/lib/perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-sola
> ris/auto/DBI:/usr/local/lib/perl5/site_perl/5.005/sun4-s
>
olaris:/usr/local/lib/perl5/5.00503/sun4-solaris:/var/rw/workspaces/SOLARIS2
> 6/SUNPRO42/4d/lib:/var/rw/workspaces/SOLARIS26/SUNPRO42/
>
12d/lib::/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI:/usr/local/li
> b/perl5/site_perl/5.005/sun4-solaris/DBD:/usr/local/lib/
>
perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBI:/us
> r/local/lib/perl5/site_perl/5.005/sun4-solaris:/usr/loca
>
l/lib/perl5/5.00503/sun4-solaris:/usr/lib:/usr/ccs/lib:/opt/SUNWspro/lib:/us
> r/openwin/lib:/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/o
>
pt/bv1to1/orbix/corba2/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product/8.0.6/l
> ib:/opt/jiat/jiat/lib';
>
$ENV{'PATH'}='/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sbin:/bin:/
> usr/bin:/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/
>
opt/bv1to1/orbix/bin:/opt/oracle/product/8.0.6/bin:/opt/gnu/bin:/opt/ode/scr
> ipts:.:/usr/local/bin:/usr/ccs/bin:/usr/ucb:/usr/local/b
>
in:/usr/ccs/bin:/usr/ucb:/usr/ccs/bin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
> :/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/opt/bv1
> to1/orbix/bin:/opt/oracle/product/8.0.6/bin:/opt/gnu/bin';
>
$ENV{'SHLIB_PATH'}='/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/opt/bv1to1/orbi
> x/original/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product
> /8.0.6/lib:.:/opt/bv1to1/orbix/lib:/opt/jiat/jiat/dynobjs';
> # Preparamos el modulo de conexion a base de datos
> use DBI;
>
> # Definicion de las variables de conexion de la DB
> my $base_datos="rumbo";  # Nombre de la base de datos
> my $usuario="jiat_Test_jiat_rumbo1_t";   # Usuario de la BD
> my $clave="jiat_Test_jiat_rumbo1_t"; # Passwd de la BD
> my $driver="Oracle"; # Usamos el driver de oracle
> my $tabla_usuarios = "bv_user";  # Nombre de la tabla que
vamos
> a consultar
> my $sql_consulta = "select user_alias from bv_user";  # Creamos la
sentencia
> SQL
>
> # Escribimos la cabecera de la pagina HTML
>
> print "Content-type: text/html\n\n";
> print "Enviroment\n";
> foreach (sort keys %ENV)
> {
>print "$_: $ENV{$_}\n";
> }
> exit;
> --
--
> --
>
> but if I execute this perl script , it don't work allright. I can see the
> same error
> can you help me?
>
> #!/usr/local/bin/perl
>
> # Cargamos las variables de entorno del profile del usuario UNIX
> $ENV{'ORACLE_HOME'}='/opt/oracle/product/8.0.6';
> $ENV{'ORACLE_SID'}='RUMBO';
>
$ENV{'LD_LIBRARY_PATH'}='/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/D
> BI:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBD
>
:/usr/local/lib/perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-sola
> ris/auto/DBI:/usr/local/lib/perl5/site_perl/5.005/sun4-s
>
olaris:/usr/local/lib/perl5/5.00503/sun4-solaris:/var/rw/workspaces/SOLARIS2
> 6/SUNPRO42/4d/lib:/var/rw/workspaces/SOLARIS26/SUNPRO42/
>
12d/lib::/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI:/usr/local/li
> b/perl5/site_perl/5.005/sun4-solaris/DBD:/usr/local/lib/
>
perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBI:/us
> r/local/lib/perl5/site_perl/5.005/sun4-solaris:/usr/loca
>
l/lib/perl5/5.00503/sun4-solaris:/usr/lib:/usr/ccs/lib:/opt/SUNWspro/lib:/us
> r/openwin/lib:/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/o
>
pt/bv1to1/orbix/corba2/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product/8.0.6/l
> ib:/opt/jiat/jiat/lib';
>
$ENV{'PATH'}='/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sbin:/bin:/
> usr/bin:/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/
>
opt

OFF_TOPIC: execute a perl script from within an asp page

2001-04-30 Thread Michael A. Chase

Please stop asking off topic questions on this list.  Even if you have a
database question, it does not belong in dbi-dev unless you are contributing
to the development of the DBI layer or a database driver.

ASP questions belong on a CGI list.  I think there is one at ActiveState,
but it is certainly not perl-win32-database.

Everyone, please ignore any more off-topic messages on these lists.  We all
get enough email already without encouraging them.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Judge Dredd" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 4:42 AM
Subject: RE: execute a perl script from within an asp page


>
> No. I've already tried this and it's working, but to
> no use. What I want to do is execute (e.g. script.pl)
> from within an asp page, as if it was a binary .cgi.
>
>
>
> --- Andrew Finkenstadt <[EMAIL PROTECTED]> wrote:
> > Do you have access to PerlScript?
> >
> > 
> >
> > use strict;
> > my $q = "Hello there!";
> > print $q;
> >  
> >
> > no?
> >
> >
> > -Original Message-
> > From: Judge Dredd [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, April 29, 2001 8:18 PM
> > To: [EMAIL PROTECTED];
> > [EMAIL PROTECTED];
> > [EMAIL PROTECTED]
> > Subject: execute a perl script from within an asp
> > page
> >
> >
> > Thanks for all the responses on my previous
> > question.
> > Apart from that, do you know of a way i could
> > execute a perl script from
> > within an asp page in IIS 5.0?
> >
> > Thanks again
> > The Judge
> >
> >
> >
> _
> > Do You Yahoo!?
> > Get your free @yahoo.com address at
> > http://mail.yahoo.com
> >
>
>
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>




Re: bind_param and dates

2001-04-30 Thread Curt Russell Crandall

Ronald,

I came to that epiphony about 1sec before reading your email.  I
was quoting before using the bind_param because I had some intermediate
queries that pulled from this same pool of data.  Unfortunately with the
setup I have, the program SEGV's when I try to pass an undef to
execute.  Since I cannot change the version of Perl and DBI/DBD::Sybase,
I'll have to think of another way around this which will ultimately make
the code look like garbage.
Thanks for the info anyway, though.

--Curt

On Mon, 30 Apr 2001, Ronald J Kimball wrote:

> On Sun, Apr 29, 2001 at 04:22:08PM -0400, Curt Russell Crandall wrote:
> > I'm getting conversion errors (VARCHAR to [SMALL]DATETIME) on an
> > insert.  I have a structure that contains a list of params that need to be
> > inserted into a db table.  Prior to insertion, I make sure that undef
> > values are treated as SQL NULLs:
> > 
> > for (my $i = 0; $i <= $#array; $i++)
> >  {
> >  if ((!DBI::looks_like_number($array[$i]) && (!$array[$i]))
> >   {
> >   $array[$i] = $dbh->quote($array[$i];
> >   }
> >  }
> > 
> > 
> > Then I go through and use bind_param on all the array members, specifying
> > each params SQL data type:
> > 
> > $sth->bind_param(1, \$array[0], SQL_DATE);
> > 
> > 
> 
> You should use either $dbh->quote() OR $sth->bind_param().  If you use
> both, then you are inserting the literal string 'NULL', not the special SQL
> value NULL.  With placeholders, the quoting is handled automatically.
> 
> Ronald
> 




Re: bind_param and dates

2001-04-30 Thread Ronald J Kimball

On Sun, Apr 29, 2001 at 04:22:08PM -0400, Curt Russell Crandall wrote:
> I'm getting conversion errors (VARCHAR to [SMALL]DATETIME) on an
> insert.  I have a structure that contains a list of params that need to be
> inserted into a db table.  Prior to insertion, I make sure that undef
> values are treated as SQL NULLs:
> 
> for (my $i = 0; $i <= $#array; $i++)
>  {
>  if ((!DBI::looks_like_number($array[$i]) && (!$array[$i]))
>   {
>   $array[$i] = $dbh->quote($array[$i];
>   }
>  }
> 
> 
> Then I go through and use bind_param on all the array members, specifying
> each params SQL data type:
> 
> $sth->bind_param(1, \$array[0], SQL_DATE);
> 
> 

You should use either $dbh->quote() OR $sth->bind_param().  If you use
both, then you are inserting the literal string 'NULL', not the special SQL
value NULL.  With placeholders, the quoting is handled automatically.

Ronald



RE: DBD-Oracle

2001-04-30 Thread Antonio Hernández

ok, thanks

I have probe this, and the result is ok, in web browser I can see all vars
allright, 

# Cargamos las variables de entorno del profile del usuario UNIX
$ENV{'ORACLE_HOME'}='/opt/oracle/product/8.0.6';
$ENV{'ORACLE_SID'}='RUMBO';
$ENV{'LD_LIBRARY_PATH'}='/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/D
BI:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBD
:/usr/local/lib/perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-sola
ris/auto/DBI:/usr/local/lib/perl5/site_perl/5.005/sun4-s
olaris:/usr/local/lib/perl5/5.00503/sun4-solaris:/var/rw/workspaces/SOLARIS2
6/SUNPRO42/4d/lib:/var/rw/workspaces/SOLARIS26/SUNPRO42/
12d/lib::/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI:/usr/local/li
b/perl5/site_perl/5.005/sun4-solaris/DBD:/usr/local/lib/
perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBI:/us
r/local/lib/perl5/site_perl/5.005/sun4-solaris:/usr/loca
l/lib/perl5/5.00503/sun4-solaris:/usr/lib:/usr/ccs/lib:/opt/SUNWspro/lib:/us
r/openwin/lib:/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/o
pt/bv1to1/orbix/corba2/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product/8.0.6/l
ib:/opt/jiat/jiat/lib';
$ENV{'PATH'}='/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sbin:/bin:/
usr/bin:/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/
opt/bv1to1/orbix/bin:/opt/oracle/product/8.0.6/bin:/opt/gnu/bin:/opt/ode/scr
ipts:.:/usr/local/bin:/usr/ccs/bin:/usr/ucb:/usr/local/b
in:/usr/ccs/bin:/usr/ucb:/usr/ccs/bin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
:/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/opt/bv1
to1/orbix/bin:/opt/oracle/product/8.0.6/bin:/opt/gnu/bin';
$ENV{'SHLIB_PATH'}='/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/opt/bv1to1/orbi
x/original/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product
/8.0.6/lib:.:/opt/bv1to1/orbix/lib:/opt/jiat/jiat/dynobjs';
# Preparamos el modulo de conexion a base de datos
use DBI;

# Definicion de las variables de conexion de la DB
my $base_datos="rumbo";  # Nombre de la base de datos
my $usuario="jiat_Test_jiat_rumbo1_t";   # Usuario de la BD
my $clave="jiat_Test_jiat_rumbo1_t"; # Passwd de la BD
my $driver="Oracle"; # Usamos el driver de oracle
my $tabla_usuarios = "bv_user";  # Nombre de la tabla que vamos
a consultar
my $sql_consulta = "select user_alias from bv_user";  # Creamos la sentencia
SQL

# Escribimos la cabecera de la pagina HTML

print "Content-type: text/html\n\n";
print "Enviroment\n";
foreach (sort keys %ENV)
{
   print "$_: $ENV{$_}\n";
}
exit;

--

but if I execute this perl script , it don't work allright. I can see the
same error
can you help me?

#!/usr/local/bin/perl

# Cargamos las variables de entorno del profile del usuario UNIX
$ENV{'ORACLE_HOME'}='/opt/oracle/product/8.0.6';
$ENV{'ORACLE_SID'}='RUMBO';
$ENV{'LD_LIBRARY_PATH'}='/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/D
BI:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBD
:/usr/local/lib/perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-sola
ris/auto/DBI:/usr/local/lib/perl5/site_perl/5.005/sun4-s
olaris:/usr/local/lib/perl5/5.00503/sun4-solaris:/var/rw/workspaces/SOLARIS2
6/SUNPRO42/4d/lib:/var/rw/workspaces/SOLARIS26/SUNPRO42/
12d/lib::/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI:/usr/local/li
b/perl5/site_perl/5.005/sun4-solaris/DBD:/usr/local/lib/
perl5/5.00503:/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBI:/us
r/local/lib/perl5/site_perl/5.005/sun4-solaris:/usr/loca
l/lib/perl5/5.00503/sun4-solaris:/usr/lib:/usr/ccs/lib:/opt/SUNWspro/lib:/us
r/openwin/lib:/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/o
pt/bv1to1/orbix/corba2/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product/8.0.6/l
ib:/opt/jiat/jiat/lib';
$ENV{'PATH'}='/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sbin:/bin:/
usr/bin:/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/
opt/bv1to1/orbix/bin:/opt/oracle/product/8.0.6/bin:/opt/gnu/bin:/opt/ode/scr
ipts:.:/usr/local/bin:/usr/ccs/bin:/usr/ucb:/usr/local/b
in:/usr/ccs/bin:/usr/ucb:/usr/ccs/bin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
:/usr/ucb:/etc:/usr/openwin/bin:/opt/bv1to1/bin:/opt/bv1
to1/orbix/bin:/opt/oracle/product/8.0.6/bin:/opt/gnu/bin';
$ENV{'SHLIB_PATH'}='/opt/bv1to1/lib:/opt/bv1to1/lib/objects:/opt/bv1to1/orbi
x/original/lib:/opt/bv1to1/rogue/lib:/opt/oracle/product
/8.0.6/lib:.:/opt/bv1to1/orbix/lib:/opt/jiat/jiat/dynobjs';
# Preparamos el modulo de conexion a base de datos
use DBI;

# Definicion de las variables de conexion de la DB
my $base_datos="rumbo";  # Nombre de la base de datos
my $usuario="jiat_Test_jiat_rumbo1_t";   # Usuario de la BD
my $clave="jiat_Test_jiat_rumbo1_t"; # Passwd de la BD
my $driver="Oracle"; # Usamos el driver de oracle
my $tabla_usuarios = "bv_user";  # Nombre de la tabla que vamos
a consultar
my $sql_consulta = "select user_alias from bv_user";  # Creamos la sentenci

Re: DBD-Oracle

2001-04-30 Thread Michael A. Chase

You would be far better off getting it added to the webserver configuration.
That way when a new version of Oracle is installed ORACLE_HOME only has to
change in one place.

To see how to change an environment variable in a script, run 'perldeoc
perlvar' and search for %ENV.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Antonio Hernández" <[EMAIL PROTECTED]>
To: "'Sikkandar Dulkarnai'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 4:25 AM
Subject: RE: DBD-Oracle


How can I define the ORACLE_HOME in the script?

-Mensaje original-
De: Sikkandar Dulkarnai [mailto:[EMAIL PROTECTED]]
Enviado el: Monday, April 30, 2001 12:38 PM
Para: Antonio Hernández; [EMAIL PROTECTED]
Asunto: RE: DBD-Oracle

Define the ORACLE_HOME either in your Web server or in your script. I had
the same problem and it was OK when I define the ORACLE_HOME in httpd.conf
(Apache) ...





Re: (Fwd) oracle 7

2001-04-30 Thread Michael A. Chase

Get either Pro*C or OCI installed in the Linux machine.  One or the other
should be in the CD or archive you installed the Oracle client software
from.

Please send further questions to dbi-users, Tim is very busy.  You will note
that your question was delayed a day for him to forward it to the list.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Tim Bunce" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 12:37 AM
Subject: (Fwd) oracle 7


> - Forwarded message from Lorenzo Viola <[EMAIL PROTECTED]> -
>
> Date: Sun, 29 Apr 2001 01:27:04 +0100
> To: [EMAIL PROTECTED]
> From: Lorenzo Viola <[EMAIL PROTECTED]>
> Subject: oracle 7
>
> I'm a quite desperate developer who is trying to get out from the
following
> situation :
>
> Database Oracle 7 on NT server
> Client Linux Debian with Perl 5
>
> I've tried installing DBD::Oracle (last version), but I don't have .mk
> files (from PRO*C)
> I've also tried installing ODBC driver, but I get a segmentation fault on
> testing
> (I exported DBD_DSN, DBD_USER, ODBCINI, LD_LIBRARY_PATH, etc.etc. )
>
> Is there any other driver/software available (possibly free) to connect to
> the server
> database ? I'm in trouble with this problem/customer, and in need of a
> solution...





Re: DBD-Oracle

2001-04-30 Thread Michael A. Chase

The most common cause for this is that the webserver process doesn't have
either or both of ORACLE_HOME and LD_LIBRARY_PATH defined or one of them
does not have the correct directories in them.  You can usually set
ORACLE_HOME inside your script, but it is usually better to set both in the
webserver configuration files.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Antonio Hernández" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 2:57 AM
Subject: DBD-Oracle


I have a problem with a perl script using DBI.
I have installed:
Solaris 2.6 in a sun4 sparc
Perl 5.005_03 built for sun4-solaris
DBI 1.14
DBD-Oracle 1.06
Oracle 8
Netscape web server

If I execute this script in a shell , it works but in web browser doesn't
work
The web server error is:
at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html





RE: DBD-Oracle

2001-04-30 Thread Antonio Hernández

Ok, thanks

any question

How can I define the ORACLE_HOME in the script?



--
Antonio Hernández
Development Executive, IT Systems
RUMBO
C/Procion, 1-3 - 28023 - Madrid - Spain
Tlf.: (34)913.076.689 (EXT. 31038)
Fax: (34)913.728.550
[EMAIL PROTECTED]  
http://www.rumbo.es  




-Mensaje original-
De: Sikkandar Dulkarnai [mailto:[EMAIL PROTECTED]]
Enviado el: Monday, April 30, 2001 12:38 PM
Para: Antonio Hernández; [EMAIL PROTECTED]
Asunto: RE: DBD-Oracle


Antonio,

Define the ORACLE_HOME either in your Web server or in your script. I had
the same problem and it was OK when I define the ORACLE_HOME in httpd.conf
(Apache) ...

Regards,

Sikkandar

-Original Message-
From: Antonio Hernández [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 12:57
To: '[EMAIL PROTECTED]'
Subject: DBD-Oracle


Hi all

I have a problem with a perl script using DBI.
I have installed:
Solaris 2.6 in a sun4 sparc
Perl 5.005_03 built for sun4-solaris
DBI 1.14
DBD-Oracle 1.06
Oracle 8
Netscape web server

Perl
If I execute this script in a shell , it works but in web browser doesn't
work
The web server error is:
at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html

this is the source code:

#!/usr/local/bin/perl

# Preparamos el modulo de conexion a base de datos
use DBI;

# Definicion de las variables de conexion de la DB
my $base_datos="db_name";  # Nombre de la base de datos
my $usuario="usuario";   # Usuario de la BD
my $clave="password"; # Passwd de la BD
my $driver="Oracle"; # Usamos el driver de oracle
my $tabla_usuarios = "bv_user";  # Nombre de la tabla que vamos
a consultar
my $sql_consulta = "select user_alias from bv_user";  # Creamos la sentencia
SQL

# Escribimos la cabecera de la pagina HTML
print "Content-type: text/html\n\n";
escribe_inicio_html();

# Conectamos con la BD
my $dbh = DBI->connect("dbi:$driver:$base_datos",$usuario,$clave) || die
"\nError al abrir la base de datos: $DBI::er
rstr\n";

#Realizamos la etapa de preparación de la sentencia
my $sth = $dbh->prepare($sql_consulta);

#Realizamos la etapa de ejecución de la sentencia
$sth->execute();

# Mostramos los usuarios via Web
while ( $users=$sth->fetchrow_array())
{
   muestra_usuario($users);
}

#Liberacion de recursos ocpupados por la sentencia
$sth->finish();

#Desconexion de la BD, mostramos mensaje si algo falla
$dbh->disconnect || warn "\nError al desconectar.\nError: $DBI::errstr\n";

escribe_final_html();

exit;

# * FUNCIONES 
# * En esta funcion muestra el usuario que se le pasa como parametro *
# * el formato es muestra_usuario($users);   *
sub muestra_usuario()
{
my ($users)=@_;

print <
 
 $users
 




usuario_HTML
}

# *
# * En esta funcion escribimos el principio de la pagina HTML *
sub escribe_inicio_html()
{

print <

Listar artículos (CGI)



 

 
LISTAR
USUARIOS (CGI)
 

 





 
 Usuario
 


inicio_HTML
}

# ***
# * En esta funcion escribimos el fin de la pagina HTML *
sub escribe_final_html()
{

print <


fin_HTML
}














at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html

--
Antonio Hernández
Development Executive, IT Systems
RUMBO
C/Procion, 1-3 - 28023 - Madrid - Spain
Tlf.: (34)913.076.689 (EXT. 31038)
Fax: (34)913.728.550
  [EMAIL PROTECTED]
  http://www.rumbo.es






Re: Works (NOT)

2001-04-30 Thread Michael A. Chase

If the script works from the shell, but not when running from the webserver,
the problem is with the account the webserver is running under.  Either the
webserver process doesn't have some of the environment variables set that
your shell account does or some of the required files are not accessible to
the webserver process.

In either case, it is not a DBI problem; it's a webserver setup problem.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Mike McPherson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 29, 2001 7:48 PM
Subject: Works (NOT)


I have DBD::ODBC installed using Openlink with iodbc.  Whe I run a script
from the shell it works as is expected.  Same script yet run via a web page
and it returns the following error.

Couldn't connect to database[OpenLink][ODBC]RPC: Unknown host (SQL-08004)
[OpenLink][ODBC]Connection rejected by data source (SQL-08004)(DBD:
db_login/SQLConnect err=-1) at /home/httpd/cgi-bin/hafa.pl line 18.

What could I be doing wrong ?





RE: DBD-Oracle

2001-04-30 Thread Sikkandar Dulkarnai

Antonio,

Define the ORACLE_HOME either in your Web server or in your script. I had
the same problem and it was OK when I define the ORACLE_HOME in httpd.conf
(Apache) ...

Regards,

Sikkandar

-Original Message-
From: Antonio Hernández [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 12:57
To: '[EMAIL PROTECTED]'
Subject: DBD-Oracle


Hi all

I have a problem with a perl script using DBI.
I have installed:
Solaris 2.6 in a sun4 sparc
Perl 5.005_03 built for sun4-solaris
DBI 1.14
DBD-Oracle 1.06
Oracle 8
Netscape web server

Perl
If I execute this script in a shell , it works but in web browser doesn't
work
The web server error is:
at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html

this is the source code:

#!/usr/local/bin/perl

# Preparamos el modulo de conexion a base de datos
use DBI;

# Definicion de las variables de conexion de la DB
my $base_datos="db_name";  # Nombre de la base de datos
my $usuario="usuario";   # Usuario de la BD
my $clave="password"; # Passwd de la BD
my $driver="Oracle"; # Usamos el driver de oracle
my $tabla_usuarios = "bv_user";  # Nombre de la tabla que vamos
a consultar
my $sql_consulta = "select user_alias from bv_user";  # Creamos la sentencia
SQL

# Escribimos la cabecera de la pagina HTML
print "Content-type: text/html\n\n";
escribe_inicio_html();

# Conectamos con la BD
my $dbh = DBI->connect("dbi:$driver:$base_datos",$usuario,$clave) || die
"\nError al abrir la base de datos: $DBI::er
rstr\n";

#Realizamos la etapa de preparación de la sentencia
my $sth = $dbh->prepare($sql_consulta);

#Realizamos la etapa de ejecución de la sentencia
$sth->execute();

# Mostramos los usuarios via Web
while ( $users=$sth->fetchrow_array())
{
   muestra_usuario($users);
}

#Liberacion de recursos ocpupados por la sentencia
$sth->finish();

#Desconexion de la BD, mostramos mensaje si algo falla
$dbh->disconnect || warn "\nError al desconectar.\nError: $DBI::errstr\n";

escribe_final_html();

exit;

# * FUNCIONES 
# * En esta funcion muestra el usuario que se le pasa como parametro *
# * el formato es muestra_usuario($users);   *
sub muestra_usuario()
{
my ($users)=@_;

print <
 
 $users
 




usuario_HTML
}

# *
# * En esta funcion escribimos el principio de la pagina HTML *
sub escribe_inicio_html()
{

print <

Listar artículos (CGI)



 

 
LISTAR
USUARIOS (CGI)
 

 





 
 Usuario
 


inicio_HTML
}

# ***
# * En esta funcion escribimos el fin de la pagina HTML *
sub escribe_final_html()
{

print <


fin_HTML
}














at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html

--
Antonio Hernández
Development Executive, IT Systems
RUMBO
C/Procion, 1-3 - 28023 - Madrid - Spain
Tlf.: (34)913.076.689 (EXT. 31038)
Fax: (34)913.728.550
  [EMAIL PROTECTED]
  http://www.rumbo.es







Re: Can DBD::Oracle connect to various versions of Oracle?

2001-04-30 Thread Peter J . Holzer

On 2001-04-29 13:50:38 -0700, David Good wrote:
> Hmm.  I wonder why our Oracle developer has several different Makefiles
> to build stuff based on the Oracle version?

Probably to build applications for different client releases. If you
have compiled and linked an app against 8.1.7 you cannot install it on a
PC which has only the Oracle 7 client installation on it (and probably
not even on one with 8.0.6). This is also the case with DBI. If you
build DBD::Oracle against 8.1.7, you must ensure that all the machines
you want to install it on have 8.1.7 installed[1]. It can connect to older
databases, though.

hp

[1] Someone once figured out the minimum of files which was needed to
run DBD::Oracle. You should be able to find it in the archives, but it
may change from release to release. The best is probably to do a full
client installation. 

-- 
   _  | Peter J. Holzer  | It's nice to fix problems by accident.
|_|_) | Sysadmin WSR / LUGA  |-- Theo de Raadt
| |   | [EMAIL PROTECTED]|   <[EMAIL PROTECTED]> 
__/   | http://www.hjp.at/   |   on bugtraq 2001-03-19

 PGP signature


DBD-Oracle

2001-04-30 Thread Antonio Hernández

Hi all
 
I have a problem with a perl script using DBI.
I have installed:
Solaris 2.6 in a sun4 sparc
Perl 5.005_03 built for sun4-solaris
DBI 1.14
DBD-Oracle 1.06
Oracle 8
Netscape web server
 
Perl 
If I execute this script in a shell , it works but in web browser doesn't
work
The web server error is:
at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html 
 
this is the source code:
 
#!/usr/local/bin/perl
 
# Preparamos el modulo de conexion a base de datos
use DBI;
 
# Definicion de las variables de conexion de la DB
my $base_datos="db_name";  # Nombre de la base de datos
my $usuario="usuario";   # Usuario de la BD
my $clave="password"; # Passwd de la BD
my $driver="Oracle"; # Usamos el driver de oracle
my $tabla_usuarios = "bv_user";  # Nombre de la tabla que vamos
a consultar
my $sql_consulta = "select user_alias from bv_user";  # Creamos la sentencia
SQL
 
# Escribimos la cabecera de la pagina HTML
print "Content-type: text/html\n\n";
escribe_inicio_html();
 
# Conectamos con la BD
my $dbh = DBI->connect("dbi:$driver:$base_datos",$usuario,$clave) || die
"\nError al abrir la base de datos: $DBI::er
rstr\n";
 
#Realizamos la etapa de preparación de la sentencia
my $sth = $dbh->prepare($sql_consulta);
 
#Realizamos la etapa de ejecución de la sentencia
$sth->execute();
 
# Mostramos los usuarios via Web
while ( $users=$sth->fetchrow_array())
{
   muestra_usuario($users);
}
 
#Liberacion de recursos ocpupados por la sentencia
$sth->finish();
 
#Desconexion de la BD, mostramos mensaje si algo falla
$dbh->disconnect || warn "\nError al desconectar.\nError: $DBI::errstr\n";
 
escribe_final_html();
 
exit;

# * FUNCIONES 
# * En esta funcion muestra el usuario que se le pasa como parametro *
# * el formato es muestra_usuario($users);   *
sub muestra_usuario()
{
my ($users)=@_;
 
print <
 
 $users
 

 


usuario_HTML
}
 
# *
# * En esta funcion escribimos el principio de la pagina HTML *
sub escribe_inicio_html()
{
 
print <

Listar artículos (CGI)



 

 
LISTAR
USUARIOS (CGI)
 

 





 
 Usuario
 

 
inicio_HTML
}
 
# ***
# * En esta funcion escribimos el fin de la pagina HTML *
sub escribe_final_html()
{
 
print <


fin_HTML
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
at (eval 1) line 3 Perhaps a required shared library or dll isn't installed
where expected at /opt/jiat/jiat/cgi-bin/perlcgi line 23 Content-type:
text/html 

--
Antonio Hernández
Development Executive, IT Systems
RUMBO
C/Procion, 1-3 - 28023 - Madrid - Spain
Tlf.: (34)913.076.689 (EXT. 31038)
Fax: (34)913.728.550
  [EMAIL PROTECTED]
  http://www.rumbo.es


 



RE: Easiest way to tell if a table already exists?

2001-04-30 Thread PD Miller

At 21:56 -0400 25/4/01, Sterin, Ilya wrote:
>Why would (select * from foo) take up lost of resources?  Won't it just
>place the cursor at the first row and only return when rows are fetched?

Speaking for Oracle, as soon as the statement is executed (and before 
any fetch) Oracle will execute the statement - and that means 
performing the full table scan(s) or index scan(s) necessary to 
fulfill the statement.

In fact, any transactional (and therefore relational) database will 
have to do the same. The point in time for data consistency is the 
instant of execution, and for non-Oracle databases, locks will be 
applied at the time of the execution.

It is bad practice to execute queries of the form often mentioned in 
this thread with no predicate. The waste of resource could be very 
significant (on some of our databases possibly several hours). If you 
need to know if a table exists, query the SQL standard data 
dictionary: select table_name from  user_tables where table_name = 
'TABLE_NAME';

Regards

Paul Miller
-- 
-
Carib Data Limited






Re: Easiest way to tell if a table already exists?

2001-04-30 Thread Mark Thornber

Mark,

Why not interrogate the system catalogue ?  Then if the table does not
exist zero rows will be returned.

If the database you are using does not allow you to access the catalogue
with standard SQL then it should not call itself a relational database.
(See E.F. Codd's Rules for Relational Databases)


--Mark Thornber

Mark Riehl wrote:
> 
> All,
> 
> What's the easiest way to check and see if a table already exists in a
> database?  I'm running MySQL on a Win2k box.
> 
> The New Riders MySQL book has the following statements:
> SELECT COUNT(*) FROM table_name
> SELECT * FROM table_name WHERE 1=0
> 
> Each statement will succeed if the table exists.
> 
> Any other way (other than calling $dbh->tables() and looping through the
> results?
> 
> Thanks,
> Mark
> 
> --
> Mark Riehl
> Agile Communications, Inc.
> Email: [EMAIL PROTECTED]




(Fwd) oracle 7

2001-04-30 Thread Tim Bunce

- Forwarded message from Lorenzo Viola <[EMAIL PROTECTED]> -

Date: Sun, 29 Apr 2001 01:27:04 +0100
To: [EMAIL PROTECTED]
From: Lorenzo Viola <[EMAIL PROTECTED]>
Subject: oracle 7

Hi, I'm Lorenzo Viola from Italy.

I'm a quite desperate developer who is trying to get out from the following 
situation :

Database Oracle 7 on NT server
Client Linux Debian with Perl 5

I've tried installing DBD::Oracle (last version), but I don't have .mk 
files (from PRO*C)
I've also tried installing ODBC driver, but I get a segmentation fault on 
testing
(I exported DBD_DSN, DBD_USER, ODBCINI, LD_LIBRARY_PATH, etc.etc. )

Is there any other driver/software available (possibly free) to connect to 
the server
database ? I'm in trouble with this problem/customer, and in need of a 
solution...

please excuse me for this intrusion, and let me know if possible...

best regards!

Computers are useless.They can only give you answers.Pablo Picasso(1881-1973)
WorkSite : http://www.eulogika.net - EulogiKa Software House



- End forwarded message -