RE: bind varray as in or inout param

2006-01-24 Thread Ted Behling
One workaround, although somewhat inelegant, would be to turn your array
into a Perl string, then interpolate the string into an anonymous PL/SQL
block which invokes the procedure.  You could use something like the
following half-pseudocode:


$varray = join(q{', '}, @input_array);

$sth = $dbh->prepare(
To: 
Sent: Tuesday, January 24, 2006 11:44 AM
Subject: bind varray as in or inout param


Hi,



Can I pass in a VARRAY data type to an oracle stored procedure via perl
or receive VARRAY from Oracle SP?



Thanks,



KS





RE: extra dependancies vs. testability?

2006-01-10 Thread Ted Behling
Sorry for replying to my own e-mail, but I had another thought.  What about 
just failing gracefully if SQLite2 isn't available?  If it's installed, it gets 
used; if not, a warning is shown and the dependent tests are skipped. 

-Original Message-----
From: Ted Behling 
Sent: Tuesday, January 10, 2006 10:12 PM
To: dbi-users@perl.org
Subject: RE: extra dependancies vs. testability?


I haven't used this module myself, but perhaps create two test suites: "make 
test" tests everything you can test without burdensome external dependencies, 
and "make testsql" either depends specifically SQLite2 or using a user-provided 
DSN.  The users who want to put more effort into testing can invoke the latter. 
 I'm not sure if this is an appropriate solution for "smoke testing", though.

Ted Behling

-Original Message-
From: Tyler MacDonald [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 10, 2006 9:43 PM
To: dbi-users@perl.org
Subject: extra dependancies vs. testability?


DBIx::Transaction currently only depends on DBI, but for it's unit
tests to run you need a DBI driver available. If SQLite2 is available, it
gives you a nice default DSN to test DBIx::Transaction in a completely
self-contained environment.

The problem I'm facing is that smoke testers (notably CPAN testers
and ppm.activestate.com) can't automatically test this module properly
because the test dependancy on having some sort of DSN isn't made obvious to
them. I'm in a bit of a dilemma here. I'd like my package to be
automatically testable against some sort of "real" DBD driver, but I don't
neccessarily want every person who installs my module to be obliged to
install DBD::SQLite2 alongside it. As nice of a module as it is, it seems
like bloat if they're never going to use it for anything else.

What do you think I should do about this? Bite the bullet and depend
on SQLite2? Create an overly complex mock object that doesn't emulate any
"real" DBD driver's behaviour? Or is there another, better solution?

Thanks,
Tyler




RE: extra dependancies vs. testability?

2006-01-10 Thread Ted Behling
I haven't used this module myself, but perhaps create two test suites: "make 
test" tests everything you can test without burdensome external dependencies, 
and "make testsql" either depends specifically SQLite2 or using a user-provided 
DSN.  The users who want to put more effort into testing can invoke the latter. 
 I'm not sure if this is an appropriate solution for "smoke testing", though.

Ted Behling

-Original Message-
From: Tyler MacDonald [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 10, 2006 9:43 PM
To: dbi-users@perl.org
Subject: extra dependancies vs. testability?


DBIx::Transaction currently only depends on DBI, but for it's unit
tests to run you need a DBI driver available. If SQLite2 is available, it
gives you a nice default DSN to test DBIx::Transaction in a completely
self-contained environment.

The problem I'm facing is that smoke testers (notably CPAN testers
and ppm.activestate.com) can't automatically test this module properly
because the test dependancy on having some sort of DSN isn't made obvious to
them. I'm in a bit of a dilemma here. I'd like my package to be
automatically testable against some sort of "real" DBD driver, but I don't
neccessarily want every person who installs my module to be obliged to
install DBD::SQLite2 alongside it. As nice of a module as it is, it seems
like bloat if they're never going to use it for anything else.

What do you think I should do about this? Bite the bullet and depend
on SQLite2? Create an overly complex mock object that doesn't emulate any
"real" DBD driver's behaviour? Or is there another, better solution?

Thanks,
Tyler




RE: Fwd: Module submission DBIx::DB

2006-01-02 Thread Ted Behling
Perhaps use Schema::RDBMS::Foo.  This would allow for non-RDBMS schema modules, 
based on XML, DB files, or others.

-Original Message-
From: Tyler MacDonald [mailto:[EMAIL PROTECTED]
Sent: Monday, January 02, 2006 3:28 PM
To: Jay Strauss
Cc: dbi-users@perl.org
Subject: Re: Fwd: Module submission DBIx::DB


> If so, for naming why does it need to be DBIx why not RDBMS::Schema::Blah

Well, the "RDBMS::" namespace doesn't seem to exist on CPAN yet...
Of course, neither does the "Schema::" namespace. So maybe just
"Schema::Blah"?

- Tyler


RE: LongReadLen, lengthb() and Oracle

2005-12-14 Thread Ted Behling
Found this Web page on the topic; HTH:

http://www.arikaplan.com/oracle/ari80597b.html

Ted Behling

-Original Message-
From: Ron Savage [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 13, 2005 7:39 PM
To: List - DBI users
Subject: LongReadLen, lengthb() and Oracle

Hi Folks

The DBI docs for LongReadLen say to use LENGTHB() for Oracle, but that
gives me an error:

ORA-00932: inconsistent datatypes: expected NUMBER got LONG

when I do:

select max(lengthb(a_session) ) from sessions;

And, yes, sessions is for CGI::Session, and a_session is of type long.

This is Oracle 10, DBI 1.48, DBD::Oracle 1.16.

Any ideas?
--
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html





RE: select placeholder

2005-12-12 Thread Ted Behling
I take it the real problem is that your query is not returning any data.
Could it be that you're loading @duplist from a file, and it ends with a
newline?  Try adding:

chomp $custnum;

before your execute() call.

-Original Message-
From: John [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 12, 2005 6:14 PM
Cc: dbi-users@perl.org
Subject: Re: select placeholder


I don't think that is the issue, in fact I don't think it is a DBI/SQL
issue at all because when I do this:
[code]
{
#$custnum = shift @duplist;
#redo if int($custnum) == 0;
$custnum = "000281610";   <===###

$sth1->execute( $custnum ) or die "couldn't execute... " .
DBI->errstr;

while (my $rowref = $sth1->fetchrow_arrayref) {
   ($asset, $custnum, $branch, $customer, $address, $town,
$postcode) = @$rowref;
[/code]

it works.

I will look into how I load @duplist and if I have further problems I
will take them elsewhere.

--
Regards
John McMahon  ([EMAIL PROTECTED])



RE: Bareword "DBI::SQL_INTEGER" not allowed while "strict subs"

2005-12-11 Thread Ted Behling
It's hard to say exactly why that's happening without seeing a snippet of your 
code, but try using:

DBI::SQL_INTEGER()

In other words, add the () at the end.

-Original Message-
From: Patrick Danley [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 11, 2005 6:45 PM
To: dbi-users@perl.org
Subject: Bareword "DBI::SQL_INTEGER" not allowed while "strict subs"


I am new to DBI, Perl, and SQL and I am currently trying to piece  
together a group of bioinformatic programs.  In running the database  
element of the package, I recieve a number of :

Bareword "DBI::SQL_INTEGER" not allowed while "strict subs" in use  
errors (a full listing of the error is pasted below).

Does anyone have experience with this error and/or suggestions on how  
i might resolve it?

I am truly a novice, 3 days in, so simple explanations would be  
especially appreciated.




I'm running :

Perl 5.8.6
dbi-pm 5.8.6
PostgreSQL -perl-586
Mac OS 10.4.2





Bareword "DBI::SQL_INTEGER" not allowed while "strict subs" in use  
at /sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Bareword "DBI::SQL_SMALLINT" not allowed while "strict subs" in use  
at /sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Bareword "DBI::SQL_DECIMAL" not allowed while "strict subs" in use  
at /sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Bareword "DBI::SQL_FLOAT" not allowed while "strict subs" in use at / 
sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Bareword "DBI::SQL_REAL" not allowed while "strict subs" in use at / 
sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Bareword "DBI::SQL_DOUBLE" not allowed while "strict subs" in use at / 
sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Bareword "DBI::SQL_NUMERIC" not allowed while "strict subs" in use  
at /sw/lib/perl5/5.8.6/darwin-thread-multi-2level/DBD/Pg.pm line 1168.
Compilation failed in require at /Users/TheBucket/lib/Perl/PartiGene/ 
PG_db.pm line 6.
BEGIN failed--compilation aborted at /Users/TheBucket/lib/Perl/ 
PartiGene/PG_db.pm line 6.
Compilation failed in require at /Users/TheBucket/genome/bin/ 
PartiGene_db.pl line 4.
BEGIN failed--compilation aborted at /Users/TheBucket/genome/bin/ 
PartiGene_db.pl line 4.



Patrick Danley, Ph.D.

Postdoctoral Researcher
Department of Biology
University of Maryland

phone 301.405.8303
fax 301.314.9358
email [EMAIL PROTECTED]
http://www.life.umd.edu/biology/shawlab/patrickdanley






RE: select placeholder

2005-12-11 Thread Ted Behling
Where you say "WHERE custnum == ?", there ought to be only one equals sign.

Ted Behling

-Original Message-
From: John [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 11, 2005 12:40 AM
To: dbi-users@perl.org
Subject: select placeholder


Hi

Can anyone see the error in the following code. It has to do with the 
placeholder in the select statement. Substitution fails to occur at the 
"$sth1->execute..." statement script dies at "while (my $rowref...". If 
I replace the placeholder with a literal it works as expected.

[code]
#
#  open database
#


my $dbh = DBI->connect("dbi:SQLite:$db1","","")
   or die "couldn't connect to database: " . DBI->errstr;

#
#  sql statements
#

my $st1 = "SELECT * FROM  a1 WHERE custnum == ?";

my $sth1 = $dbh->prepare($st1) or die "couldn't prepare... " . DBI->errstr;

my ($asset, $custnum, $branch, $customer, $address, $town, $postcode);
my ($line, $aline, $cline, @assets, @customers, @lines, @cust2, @unigas);
my ($done, $record, @records, %seen, $cnt, $ii, $best, @updates);

#
#  build list of duplicate details
#

#while (not defined $done)
{
$custnum = shift @duplist;
redo if int($custnum) == 0;

$sth1->execute($custnum) or die "couldn't execute... " . DBI->errstr;

while (my $rowref = $sth1->fetchrow_arrayref) {
   ($asset, $custnum, $branch, $customer, $address, $town, 
$postcode) = @$rowref;
[/code]


--
Regards
John McMahon <[EMAIL PROTECTED]>




RE: What's the best "free" DB for a web-based app?

2005-11-29 Thread Ted Behling
You're likely to get as many opinions as there are respondents to your 
question.  MySQL seems to be the most popular for smaller Web apps.  It's free, 
Free, easy to use, well documented, widely understood, and capable enough for 
most tasks.  PostgreSQL is also popular for similar reasons, but my impression 
is far fewer people are familiar with it than MySQL.  I've heard that 
PostgreSQL might be somewhat more capable than MySQL, but I haven't used 
PostgreSQL myself.  Since this sounds like your first open-source DB 
experience, I think you'd be better off with MySQL, since it's easiest to find 
help should you need it.

Ted Behling

-Original Message-
From: John Armstrong [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 29, 2005 8:02 PM
To: dbi-users@perl.org
Cc: cgiapp@lists.erlbaum.net
Subject: What's the best "free" DB for a web-based app?



Hi - I'm soon to be doing a Perl app on the Internet, that'll need
database. We want the db to be as "free" as possible, but still fully
multi-user (web-based). Would the best route be MySql on Linux? Random
access files? Something else? We want no licensing obligations (no Oracle,
Sequal Server, etc.). We want to go with Perl because it's the best
programming language invented by humans.



RE: Oracle and BLOBs

2005-11-23 Thread Ted Behling
If I remember properly, I think I saw that error when setting up
Apache::Session::Oracle.  I have my A_SESSION column set up as type
LONG.  I'm running 9iR2.  Hope that helps.

Ted Behling

-Original Message-
From: Ron Savage [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 23, 2005 7:24 PM
To: List - DBI users
Subject: Q: Oracle and BLOBs

Hi Folks

I've written CGI::Session::Driver::oracle.pm using a_session of type
BLOB, and get the Oracle error ORA-01465: invalid hex number when the
content to be inserted in that field is output from Data::Dumper.

I've read Oracle docs and dozens of questions on AskTom, but nothing
says that text put into a BLOB field must be hex-encoded.

Any ideas?

--
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html





RE: Executing PL/SQL packages in Perl

2005-11-09 Thread Ted Behling
I like to use the DBIx::ProcedureCall module from CPAN.  It provides nice 
syntactic glue around the necessary DBI calls for invoking PL/SQL functions and 
procedures.

Ted Behling

-Original Message-
From: logesh kumar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 09, 2005 6:37 AM
To: dbi-users@perl.org
Subject: Executing PL/SQL packages in Perl


Hi all,
  Can anybody tell me how to execute a PL/SQL package from Perl through 
a small example?
 
Thanks in advance,
Lokesh
 


-
 Yahoo! FareChase - Search multiple travel sites in one click.  


RE: Remote Login, using dbi:ODBC

2005-10-25 Thread Ted Behling
If you really need to log into Access remotely, check out DBD::Proxy on CPAN.

Ted

> -Original Message-
> From: Jeff Urlwin [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 24, 2005 12:22 PM
> To: [EMAIL PROTECTED]; dbi-users@perl.org
> Subject: RE: Remote Login, using dbi:ODBC
> 
> 
> This really isn't a perl/dbi issue.  If it's an MS access 
> database, you
> need to be able to access the MDB file itself.  Thus, there is no
> server/port, etc.
> 
> Jeff
> 
> 
> -Original Message-
> From: Richard [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, October 23, 2005 2:33 AM
> To: dbi-users@perl.org
> Subject: Remote Login, using dbi:ODBC
> Importance: High
> 
> I login to my remote mysql databases, using perl, this way:
> 
>  
> 
>  
> 
>  
> 
> sub ConnectToDB 
> 
> {
> 
> my $host_name = "01.002.003.04";# Ip Address Here
> 
> my $db_name = "DataBaseName"; # Database Name to 
> connect to
> 
> my $dsn = "DBI:mysql:host=$host_name;database=$db_name";
> 
> return (DBI->connect ($dsn, "usernameHere", 
> "PasswordHere",
> 
>  
> {PrintError => 0, RaiseError => 1}));
> 
> }
> 
>  
> 
> So, to connect to a Remote Access Database, can I use this:
> 
>  
> 
>  
> 
> sub ConnectToDB 
> 
> {
> 
> my $host_name = "002.003.004.05";
> 
> my $db_name = "DBName";
> 
> my $dsn =
> "dbi:ODBC:Clients:host=$host_name;database=$db_name";
> 
> return (DBI->connect ($dsn, "UserNameHere",
> "PassWordHere")); #
> Clients being the name I set in the Windows Data Sources (ODBC)
> 
> }
> 
>  
> 
>  
> 
> Is that how I would connect to this database?
> 
>  
> 
> I would appreciate any help you could give me.
> 
>  
> 
> Thanks!
> 
> Richard
> 
>  
> 
> 


RE: Newline inserted?

2005-10-24 Thread Ted Behling
I think you need to remove the semicolon at the end of the line.

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 24, 2005 2:01 PM
> To: dbi-users@perl.org
> Subject: Newline inserted?
> 
> 
> I have the following sql insert statement in a file:
> 
> INSERT INTO message(FULLDATE,HOSTNAME,FACILITY,PRIORITY,MESSAGE,SHA1)
> VALUES('2005-Oct-18 11:53:21','pkitest.wellsfargo.com','auth
> ','info','su(pam_unix)[3638]: session opened for user oracle by
> root(uid=0)','H4vgmf+OJsT99kCfQuIpALY7k9k=');
> 
> When I attempt to load this file into Oracle 10g using the 
> DBI I get the
> following error:
> 
> DBD::Oracle::st execute failed: ORA-00911: invalid character 
> (DBD ERROR:
> error possibly near <*> indicator at char 238 in 'INSERT INTO
> message(FULLDATE,HOSTNAME,FACILITY,PRIORITY,MESSAGE,SHA1)
> VALUES('2005-Oct-18
> 11:53:21','pkitest.wellsfargo.com','auth','info','su(pam_unix)[3638]:
> session opened for user oracle by
> root(uid=0)','H4vgmf+OJsT99kCfQuIpALY7k9k=')<*>;')
> 
> This is the code that loads this file:
> 
> while () {
>   chomp;
>   $sql = qq{$_};
> 
>   $sth = $dbh->prepare($sql); # Should these be outside the loop?
>   $sth->execute();
> }
> 
> Od -cx FILENAME shows a "\n" character at the <*> point in 
> the above file.
> VI -b does not. Is this a known issue with DBI and 10g or am 
> I overlooking
> something?
> 
> 
> Paul Fontenot
> WFS - CAST Operations
> Email: [EMAIL PROTECTED]
> Phone: (480) 437-7795
> 
> This message may contain confidential and/or privileged 
> information.  If you
> are not the addressee or authorized to receive this for the 
> addressee, you
> must not use, copy, disclose, or take any action based on 
> this message or
> any information herein.  If you have received this message in 
> error, please
> advise the sender immediately by reply e-mail and delete this message.
> Thank you for your cooperation.
> 


Disabling Apache::DBI

2005-10-21 Thread Ted Behling
I have multiple mod_perl applications running within one Apache instance.  For 
most of these applications, I want to use Apache::DBI, but I want to disable it 
for just one.  According to various Web pages, this is not possible, because 
Apache::DBI attaches itself to all DBI->connect() calls.  I would have to run 
my app in a separate Apache instance that excludes Apache::DBI.

It looks like it actually is possible to disable Apache::DBI.  Apache::DBI will 
not be used for a specific DBI connection if its DBI->connect() has a special 
value set for the dbi_connect_method attribute, as in:

$dbh = DBI->connect('dbi:...', '...', '...', { dbi_connect_method => 
'connect' } );

Could somebody verify that this is a sane and future-proof approach?

>From my reading of the DBI.pm source code, this works because DBI defaults to 
>using its own connect() method, then switches to Apache::DBI::connect() if 
>Apache::DBI is in use, and finally, looks for the "dbi_connect_method" 
>attribute.  By setting this attribute to the original default, "connect", 
>Apache::DBI is neatly bypassed.

This would be more elegant if a future version of DBI were to include support 
for a "disable_apache_dbi" attribute.  I think this might involve just a simple 
addition to DBI::connect().

Ted Behling, ISP Systems Analyst
Hargray Communications
[EMAIL PROTECTED]


RE: DBD-Oracle

2005-10-21 Thread Ted Behling
You appear to be using ActiveState's Perl distribution.  You might have better 
luck installing from CPAN, as in:

perl -MCPAN -e 'install DBD::Oracle'

Ted Behling, ISP Systems Analyst
Hargray Communications

> -Original Message-
> From: David Sawyer [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 21, 2005 11:01 AM
> To: dbi-users@perl.org
> Subject: DBD-Oracle
> 
> 
> I am desperately trying to install DBD-Oracle on my UNIX system.
> No matter what I try I get the error :
>  
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > ppm install
> ftp://ftp.esoftmatic.com/outgoing/DBI/5.8.4/DBD-Oracle.ppd
> <ftp://ftp.esoftmatic.com/outgoing/DBI/5.8.4/DBD-Oracle.ppd> 
> Error: no suitable installation target found for package DBD-Oracle. 
> 
> Can ANYONE offer a suggestion as to the cause of this error?
>  
>  
> Regards,
> David Sawyer
> Senior Customer Support Engineer
> Ceon Corporation
> 650-817-6334 (office) 
> 650-238-8078 (Blackberry Wireless)
> 408-832-4354 (mobile)
> www.Ceon.com
> -.- . -.. .-. ... 
>  
>