RE: Patch for DBD::ODBC 1.01 for using Informix CLI, etc.

2002-12-17 Thread Jeff Urlwin
> Dear Jeff and Tim,
> 
> Here's a patch which more or less got DBD::ODBC 1.01 up and 
> running using Informix CLI as the ODBC driver (and driver 
> manager) on Solaris.

Jonathan -- that's GREAT!  FYI -- I strongly encourage people to use a
driver manager, to simplify the building process.  unixODBC has been
quite good for me.

> 
> What did I have to fix?
> 
> First of all, for some reason I don't understand fully, my 
> system was initially diagnosed as being a udbc system.  So, I 
> had to hack Makefile.PL to avoid that mis-diagnosis.  In 
> doing so, I cleaned up the testing for other drivers and made 
> it all more consistent.  Then I added a test which heads off 
> trouble when no valid ODBC system is detected. There's now a 
> list of the ODBC drivers which are supported; this is printed 
> when no valid system is detected.

Thanks.  That needed work, as you know.  I only test with a few
different ODBC drivers/managers and mostly have accepted nearly all
patches provided.  I *really* appreciate the cleanup.

> 
> Then I had to fiddle the definitions for use with Informix 
> CLI, which was no worse than any other driver.  I made sure 
> that the detailed version and platform information for 
> Informix is in the file.  It will gently get out of date, but 
> can be brought up to date again as necessary.  It at least 
> tells people where it was originally thought to work.

Good -- nothing out of the ordinary.

> 
> I'm using a butchered DBI 1.32 that is masquerading as 1.33, 
> and it showed up a couple of minor problems in dbdimp.h -- no 
> #define for dbd_discon_all and a stray #define for dbd_db_do. 
>  Tim may yet decide those changes are too radical for DBI 
> 1.33, but this change will allow your driver to work with 
> both existing DBI versions and the future version where all 
> the functions in Driver.xst are guarded with #ifdef's. Note 
> that DBI 1.32 and earlier does not ever call dbd_db_do.
>

That might be an issue, though.  I might prefer to wait until the
release version or things settle on the DBI internals...depending upon
what Tim says.

I now see the problem with the dbd_db_do and the dbd_discon_all issues.
I have a do() replacement that starts in Perl and calls
dbd_db_execdirect.  I suppose I could rework it to use the do, but as
you pointed out, it's not called, so I'll leave it.


> I modified one (of three) calls to SQLDescribeCols() so that 
> GCC didn't witter at me about incompatible pointer types.  I 
> used an effective but crude technique; I declared a local 
> variable of the correct type and passed that to the function, 
> and then assigned the variable to the original source of 
> trouble.  It was the ColumnSize parameter (7), which was 
> being given a U32 pointer but the ODBC specs say it should be 
> an SQLUINTEGER pointer.

Yes, I just end up ignoring those, but I should probably go in and clean
them up someday.  Some platforms may care...

> 
> I ran into a problem with t/02simple.t; there was no newline 
> at the end of the output from test 9, so the 'not ok 9' was 
> getting lost.  That was easy to fix.  With that fix in place, 
> I was getting two test failures, numbers 6 and 9 in 
> t/02simple.t.  I wondered if it was my slightly unusual 
> setting of the (Informix-specific) DBDATE variable that was 
> throwing things for a wobbly, but it does not appear to be 
> that.  I'm not sure how much time to spend debugging that - 
> get back to me on it. The verbose output from the test that 
> is failing (with the extra newline in place) is in the second 
> attachment.

Hmm...it looks like some null chars are being retrieved with the data
and that's throwing the test off.  I'm somewhat surprised that more
tests didn't fail, given the data discrepancy...maybe I need to update
my tests :)

Test 9 is failing because of some strange results on the col attributes.
I'm wondering if the same null character issue is the source.

Here's the output from Oracle.
Column count is: 4
1: COL_A = 3 3 yes
2: COL_B = 12 12 yes
3: COL_C = -1 -1 yes
4: COL_D = 93 93 yes

Here's the output from your sample (normally the yes means a match is
found with grep()), so, adding carriage returns for clarity:
1: col_a = 5 5
2: col_b = 12 12
3: col_c = -1 -1
4: col_d = 93 93

For some reason, grep with $coltype == $_ isn't matching any of the test
types -- while it should.  I am thinking that a trailing null on data
returned is forcing Perl to see the numbers as characters...

> 
> I wrote README.informix with much of the same information in 
> it.  Feel free to remove the first paragraph if you accept 
> the patches I'm sending.  Amongst other things, it documents 
> that DBD::ODBC does not manage to handle Informix's 
> non-transactional databases -- I got many more failures until 
> I used a logged database.

Ok -- I'm certainly not an Informix person, so I'll take your word for
it.  I specifically test transactions and AutoCommit support, so I can
see if commit and rollback don't work, a lot

Re: DBI on a pocketPC - preliminary success

2002-12-17 Thread Dean Arnold
Just an FYI:
DBD::Teradata runs on a Theraphone (which runs PocketPC)
via 3G wireless, as well as on Zaurus via WiFi. See
www.presicient.com/terapocket
for some simple screenshots

BTW: if you try porting other DBD's that work remotely, be aware that
the ARM float format is slightly different than Intel, so any pack/unpack
to/from float may need a little extra TLC.

Also, how is the bootstrap performance on the e740 ? On the Z its pretty
poky, and the Theraphone is a bit worse...

And has anyone tried DBD::PgPP (or is it PPPg ?) What other pure Perl
DBD's are there ? DBD::Proxy ?

Later,
Dean Arnold
Presicient Corp.
www.presicient.com

- Original Message -
From: "Jeff Zucker" <[EMAIL PROTECTED]>
To: "dbi-dev" <[EMAIL PROTECTED]>; "dbi-users" <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 5:26 PM
Subject: DBI on a pocketPC - preliminary success


> Just a preliminary report - thanks to Rainier Keuchel's port of perl to
> winCE, I now have DBI (PurePerl) and DBD::AnyData doing database read
> access on my Toshiba e740 (a palm-like handheld running pocketPC on an
> xScale processor).   The port also works on most other pocketPC and
> winCE device (e.g. Ipaq, Jornada, Casio, Dell Axim, etc.).  Total
> storage requirement for perl, perlIDE, and all the required modules is
> about 3mb so it should run on a fairly minimal device, even one with no
> storage card and a low amount of ROM.
>
> I'll be doing more testing with other DBDs and eventually with Shell and
> Proxy.  If anyone else is working on this, let me know.
>
> --
> Jeff
>




DBI on a pocketPC - preliminary success

2002-12-17 Thread Jeff Zucker
Just a preliminary report - thanks to Rainier Keuchel's port of perl to 
winCE, I now have DBI (PurePerl) and DBD::AnyData doing database read 
access on my Toshiba e740 (a palm-like handheld running pocketPC on an 
xScale processor).   The port also works on most other pocketPC and 
winCE device (e.g. Ipaq, Jornada, Casio, Dell Axim, etc.).  Total 
storage requirement for perl, perlIDE, and all the required modules is 
about 3mb so it should run on a fairly minimal device, even one with no 
storage card and a low amount of ROM.

I'll be doing more testing with other DBDs and eventually with Shell and 
Proxy.  If anyone else is working on this, let me know.

--
Jeff



Re: [OT] SQL console for MSSQL

2002-12-17 Thread Thomas A. Lowery
Check out DBI::Shell or dbish. A basic version is installed with
DBI. A more advanced version is available from CPAN (requires
additional modules).

I often use it with to test DBD::ADO. (Actually I use it with
every database I work with that DBI talks with, on MS Windows,
Linux, and Solaris).

Tom

On Tue, Dec 17, 2002 at 02:16:04PM +0100, [EMAIL PROTECTED] wrote:

> this is a bit offtopic: I don't want to run to the server each time I want
> to check contents of some table: Is there a sqlconsole where I can just
> connect to the server via ODBC and do some SQL statements?

-- 
Thomas A. Lowery
See DBI/FAQ http://www.xmlproj.com/cgi/fom.cgi



Re: DBI Ignorance

2002-12-17 Thread Hardy Merrill
I'm running RH8.0, and my install came with DBI and DBD::Pg
(postgreSQL) installed - I'm not sure what installer choice(s)
you have to make to get those, but I chose everything language
(perl, etc.) and database related for my install.


Ron Stephan [[EMAIL PROTECTED]] wrote:
>  
> 
> I am still lost struggling with getting DBI up ona RH box.

No problem - we all go through that in the beginning :-)


> OS = RH8.0
> 
> Perl = RH Perl 5.8.0

Good - minor point - your perl is just plain "Perl 5.8.0" - no
"RH" in there.


> I am trying to get a DBI module installed (any kind of DBD would make me
> happy) and am striking out.

At a command prompt, do

  rpm -q perl-DBI

if 'perl-DBI-1.30-1' comes back, then you have DBI.  Then do

  rpm -qa | grep DBD

to see if you have any DBD modules installed.  Here's what shows
up on my box:

  perl-DBD-Pg-1.13-5
  perl-DBD-MySQL-2.1017-3

so I have Postgresql and MySQL database DBD's installed.

Then do

  rpm -qa | grep postgres

here's what shows up for me:

postgresql-libs-7.2.2-1
postgresql-7.2.2-1
postgresql-perl-7.2.2-1
postgresql-server-7.2.2-1
postgresql-contrib-7.2.2-1


> I have downloaded from CPAN and used every web page instruction.

Everything you need should be in your RH8.0 distribution - all the
RPM's you need are in there.  No need to go to CPAN unless you
want more recent versions of stuff, but no need to do that
immediately.


> DBI fails in the make file  "Can't load DBD"  The DBD fails in the make
> "can't find DBI".

Try the above 1st - so how far you get.

STEP 1: Before trying to get DBI and DBD:: running,
you must get a database running.  If you're not an experienced
database person, the easiest ones to start with are Postgresql
or MySQL.

HTH.


> Is the Red Hat DB the same as DBI?

No.  DBI is the Perl Database Independent layer - this, along with 
the DBD corresponding to the database of you choice, allows you to
program applications in Perl that can communicate with that database.

Red Hat DB is a database based on Postgresql.

HTH.

-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.



DBI Ignorance

2002-12-17 Thread Ron Stephan
 

I am still lost struggling with getting DBI up ona RH box.

 

OS = RH8.0

Perl = RH Perl 5.8.0

 

 

I am trying to get a DBI module installed (any kind of DBD would make me
happy) and am striking out.

 

I have downloaded from CPAN and used every web page instruction.

 

DBI fails in the make file  "Can't load DBD"  The DBD fails in the make
"can't find DBI".

 

I am totally lost.

 

Is there someplace that has a basic line by line how to?

 

Is the Red Hat DB the same as DBI?

 

 

 

Lost in LA,

 

Ron "Elvis" Stephan

310-840-4111

[EMAIL PROTECTED]

 

 




Re: "missing left parenthesis" problem running DBD::Oracle

2002-12-17 Thread Michael A Chase
On Tue, 17 Dec 2002 13:21:52 -0600 "Ford, Andy" <[EMAIL PROTECTED]> wrote:

> I'm getting an error running DBD::Oracle:
> 
> DBD::Oracle::db do failed: ORA-00906: missing left parenthesis (DBD
> ERROR:
> OCIStmtExecute/Describe) at ./trace.pl line 13.
> 
> The environment is perl 5.6.1 on Solaris 8 with DBI 1.32 and DBD-Oracle
> 1.12.
> 
> The script that produces the above error is just:
> 
> #!/opt/perl5/bin/perl -w 
> use strict;
> use diagnostics;
> use DBI;
> use DBD::Oracle;

Unless you want some constants from DBD::Oracle, you don't need to 'use'
DBD::Oracle specifically.

> my ($dbname,$user,$passwd) = qw(KONFIG *** );
> my $dev = $ARGV[0];
> BEGIN {
>   $ENV{ORACLE_HOME} = '/opt/oracle/product/8.1.6';
>   $ENV{ORACLE_SID} = 'KONFIG';
> }
> my $dbh = DBI->connect("dbi:Oracle:KONFIG", $user, $passwd);

You should either include { RaiseError => 1 } or check that the handle is
valid before using it.  For example:

   my $dbh = DBI -> connect( "dbi:Oracle:$inst", $user, $pwd )
  or die "Connect to $inst as $user failed: $DBI::errstr";
   $dbh -> {RaiseError} = 1;
or
   my $dbh = DBI -> connect( "dbi:Oracle:$inst", $user, $pwd,
  {AutoCommit => 0, PrintError => 0, RaiseError => 1} );
or
   my $dbh = DBI -> connect( "dbi:Oracle:$inst", $user, $pwd,
  {AutoCommit => 0, PrintError => 0, RaiseError => 0} )
  or die "Connect to $inst as $user failed: $DBI::errstr";
   # Explicitly test DBI method calls

> $dbh->do("SELECT uui FROM table device WHERE name = $dev");

"table" is not a valid table name.  "device" is probably being treated as a
table alias.

It is not safe to just paste a value into the SQL.  Look up placeholders in
the fine manual (perldoc DBI).

Whatever method you call, you should check it's return or test $DBI::err to
make sure there wasn't an error.

> $dbh->disconnect;
> 
> So it looks like I'm connecting OK, but the "do" fails.

do() is not appropriate for SELECT statements.  There are several examples
in the fine manuals (perldoc DBI and perldoc DBD::Oracle) and in
DBD-Oracle-1.12/Oracle.ex/.

I think the problem is that Oracle is trying to parse the misformed SQL as
a complex SELECT with a sub-SELECT; except that the '(' that starts the
sub-SELECT is missing.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.





RE: "missing left parenthesis" problem running DBD::Oracle

2002-12-17 Thread Veera Prasad
Try "select * from device"

-Original Message-
From: David N Murray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 2:28 PM
To: Ford, Andy
Cc: '[EMAIL PROTECTED]'
Subject: Re: "missing left parenthesis" problem running DBD::Oracle


SQL> select * from table device;
select * from table device
*
ERROR at line 1:
ORA-00906: missing left parenthesis


SQL>

On Dec 17, Ford, Andy scribed:

> I'm getting an error running DBD::Oracle:
>
> DBD::Oracle::db do failed: ORA-00906: missing left parenthesis (DBD ERROR:
> OCIStmtExecute/Describe) at ./trace.pl line 13.
>
> The environment is perl 5.6.1 on Solaris 8 with DBI 1.32 and DBD-Oracle
> 1.12.
>
> The script that produces the above error is just:
>
> #!/opt/perl5/bin/perl -w
> use strict;
> use diagnostics;
> use DBI;
> use DBD::Oracle;
> my ($dbname,$user,$passwd) = qw(KONFIG *** );
> my $dev = $ARGV[0];
> BEGIN {
>   $ENV{ORACLE_HOME} = '/opt/oracle/product/8.1.6';
>   $ENV{ORACLE_SID} = 'KONFIG';
> }
> my $dbh = DBI->connect("dbi:Oracle:KONFIG", $user, $passwd);
> $dbh->do("SELECT uui FROM table device WHERE name = $dev");
> $dbh->disconnect;
>
> So it looks like I'm connecting OK, but the "do" fails.
>
> Thanks
>
> Andy Ford
> A.G. Edwards & Sons, Inc.
> [EMAIL PROTECTED]
> 314-955-6647
>
>
>
> HOw bout a trace:
> DBI 1.32-nothread dispatch trace level set to 5
> -> DBI->connect(dbi:Oracle:KONFIG, konfigmgr, )
> -> DBI->install_driver(Oracle) for solaris perl=5.006001 pid=29335
> ruid=13013 euid=13013
>install_driver: DBD::Oracle version 1.12 loaded from
> /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBD/Oracle.pm
> New DBI::dr (for DBD::Oracle::dr, parent=, id=)
> dbih_setup_handle(DBI::dr=HASH(0x2d46b4)=>DBI::dr=HASH(0x3184c8),
> DBD::Oracle::dr, 0, Null!)
> dbih_make_com(Null!, DBD::Oracle::dr, 88) thr#0
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Err, Null!) SCALAR(0x29b798)
> (already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), State, Null!)
SCALAR(0x2d64e0)
> (already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Errstr, Null!)
> SCALAR(0x29b774) (already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Debug, Null!) 0 (already
> defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), FetchHashKeyName, Null!)
> 'NAME' (already defined)
> <- install_driver= DBI::dr=HASH(0x2d46b4)
> -> connect for DBD::Oracle::dr (DBI::dr=HASH(0x2d46b4)~0x3184c8
'KONFIG'
> 'konfigmgr'  HASH(0x2b5cc8))
> New DBI::db (for DBD::Oracle::db, parent=DBI::dr=HASH(0x3184c8), id=)
> dbih_setup_handle(DBI::db=HASH(0x31848c)=>DBI::db=HASH(0x3177ec),
> DBD::Oracle::db, 2d1bf4, Null!)
> dbih_make_com(DBI::dr=HASH(0x3184c8), DBD::Oracle::db, 116) thr#0
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), Err, DBI::dr=HASH(0x3184c8))
> SCALAR(0x29b798) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), State,
DBI::dr=HASH(0x3184c8))
> SCALAR(0x2d64e0) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), Errstr,
> DBI::dr=HASH(0x3184c8)) SCALAR(0x29b774) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), Debug,
DBI::dr=HASH(0x3184c8))
> 0 (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), FetchHashKeyName,
> DBI::dr=HASH(0x3184c8)) 'NAME' (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), HandleError,
> DBI::dr=HASH(0x3184c8)) undef (not defined)
> <- connect= DBI::db=HASH(0x31848c) at
> /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line 513 via
./trace.pl
> line 13
> -> STORE for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER
'PrintError'
> 1)
> STORE DBI::db=HASH(0x3177ec) 'PrintError' => 1
> <- STORE= 1 at /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm
line
> 555 via ./trace.pl line 13
> -> STORE for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER
'AutoCommit'
> 1)
> <- STORE= 1 at /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm
line
> 555 via ./trace.pl line 13
> <- connect= DBI::db=HASH(0x31848c)
> -> do in DBD::_::db for DBD::Oracle::db
(DBI::db=HASH(0x31848c)~0x3177ec
> 'SELECT uui FROM table device WHERE name = 245245')
> 1   -> prepare for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'SELECT
uui
> FROM table device WHERE name = 245245' undef)
> New DBI::st (for DBD::Oracle::st, parent=DBI::db=HASH(0x3177ec), id=)
> dbih_setup_handle(DBI::st=HASH(0x3184bc)=>DBI::st=HASH(0x318444),
> DBD::Oracle::st, 3184f8, Null!)
> dbih_make_com(DBI::db=HASH(0x3177ec), DBD::Oracle::st, 208) thr#0
> dbih_setup_attrib(DBI::st=HASH(0x318444), Err, DBI::db=HASH(0x3177ec))
> SCALAR(0x29b798) (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), State,
DBI::db=HASH(0x3177ec))
> SCALAR(0x2d64e0) (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), Errstr,
> DBI::db=HASH(0x3177ec)) SCALAR(0x29b774) (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), Debug,
DBI::db=HASH(0x3177ec))

Re: "missing left parenthesis" problem running DBD::Oracle

2002-12-17 Thread David N Murray
SQL> select * from table device;
select * from table device
*
ERROR at line 1:
ORA-00906: missing left parenthesis


SQL>

On Dec 17, Ford, Andy scribed:

> I'm getting an error running DBD::Oracle:
>
> DBD::Oracle::db do failed: ORA-00906: missing left parenthesis (DBD ERROR:
> OCIStmtExecute/Describe) at ./trace.pl line 13.
>
> The environment is perl 5.6.1 on Solaris 8 with DBI 1.32 and DBD-Oracle
> 1.12.
>
> The script that produces the above error is just:
>
> #!/opt/perl5/bin/perl -w
> use strict;
> use diagnostics;
> use DBI;
> use DBD::Oracle;
> my ($dbname,$user,$passwd) = qw(KONFIG *** );
> my $dev = $ARGV[0];
> BEGIN {
>   $ENV{ORACLE_HOME} = '/opt/oracle/product/8.1.6';
>   $ENV{ORACLE_SID} = 'KONFIG';
> }
> my $dbh = DBI->connect("dbi:Oracle:KONFIG", $user, $passwd);
> $dbh->do("SELECT uui FROM table device WHERE name = $dev");
> $dbh->disconnect;
>
> So it looks like I'm connecting OK, but the "do" fails.
>
> Thanks
>
> Andy Ford
> A.G. Edwards & Sons, Inc.
> [EMAIL PROTECTED]
> 314-955-6647
>
>
>
> HOw bout a trace:
> DBI 1.32-nothread dispatch trace level set to 5
> -> DBI->connect(dbi:Oracle:KONFIG, konfigmgr, )
> -> DBI->install_driver(Oracle) for solaris perl=5.006001 pid=29335
> ruid=13013 euid=13013
>install_driver: DBD::Oracle version 1.12 loaded from
> /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBD/Oracle.pm
> New DBI::dr (for DBD::Oracle::dr, parent=, id=)
> dbih_setup_handle(DBI::dr=HASH(0x2d46b4)=>DBI::dr=HASH(0x3184c8),
> DBD::Oracle::dr, 0, Null!)
> dbih_make_com(Null!, DBD::Oracle::dr, 88) thr#0
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Err, Null!) SCALAR(0x29b798)
> (already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), State, Null!) SCALAR(0x2d64e0)
> (already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Errstr, Null!)
> SCALAR(0x29b774) (already defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Debug, Null!) 0 (already
> defined)
> dbih_setup_attrib(DBI::dr=HASH(0x3184c8), FetchHashKeyName, Null!)
> 'NAME' (already defined)
> <- install_driver= DBI::dr=HASH(0x2d46b4)
> -> connect for DBD::Oracle::dr (DBI::dr=HASH(0x2d46b4)~0x3184c8 'KONFIG'
> 'konfigmgr'  HASH(0x2b5cc8))
> New DBI::db (for DBD::Oracle::db, parent=DBI::dr=HASH(0x3184c8), id=)
> dbih_setup_handle(DBI::db=HASH(0x31848c)=>DBI::db=HASH(0x3177ec),
> DBD::Oracle::db, 2d1bf4, Null!)
> dbih_make_com(DBI::dr=HASH(0x3184c8), DBD::Oracle::db, 116) thr#0
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), Err, DBI::dr=HASH(0x3184c8))
> SCALAR(0x29b798) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), State, DBI::dr=HASH(0x3184c8))
> SCALAR(0x2d64e0) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), Errstr,
> DBI::dr=HASH(0x3184c8)) SCALAR(0x29b774) (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), Debug, DBI::dr=HASH(0x3184c8))
> 0 (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), FetchHashKeyName,
> DBI::dr=HASH(0x3184c8)) 'NAME' (already defined)
> dbih_setup_attrib(DBI::db=HASH(0x3177ec), HandleError,
> DBI::dr=HASH(0x3184c8)) undef (not defined)
> <- connect= DBI::db=HASH(0x31848c) at
> /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line 513 via ./trace.pl
> line 13
> -> STORE for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'PrintError'
> 1)
> STORE DBI::db=HASH(0x3177ec) 'PrintError' => 1
> <- STORE= 1 at /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line
> 555 via ./trace.pl line 13
> -> STORE for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'AutoCommit'
> 1)
> <- STORE= 1 at /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line
> 555 via ./trace.pl line 13
> <- connect= DBI::db=HASH(0x31848c)
> -> do in DBD::_::db for DBD::Oracle::db (DBI::db=HASH(0x31848c)~0x3177ec
> 'SELECT uui FROM table device WHERE name = 245245')
> 1   -> prepare for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'SELECT uui
> FROM table device WHERE name = 245245' undef)
> New DBI::st (for DBD::Oracle::st, parent=DBI::db=HASH(0x3177ec), id=)
> dbih_setup_handle(DBI::st=HASH(0x3184bc)=>DBI::st=HASH(0x318444),
> DBD::Oracle::st, 3184f8, Null!)
> dbih_make_com(DBI::db=HASH(0x3177ec), DBD::Oracle::st, 208) thr#0
> dbih_setup_attrib(DBI::st=HASH(0x318444), Err, DBI::db=HASH(0x3177ec))
> SCALAR(0x29b798) (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), State, DBI::db=HASH(0x3177ec))
> SCALAR(0x2d64e0) (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), Errstr,
> DBI::db=HASH(0x3177ec)) SCALAR(0x29b774) (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), Debug, DBI::db=HASH(0x3177ec))
> 0 (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), FetchHashKeyName,
> DBI::db=HASH(0x3177ec)) 'NAME' (already defined)
> dbih_setup_attrib(DBI::st=HASH(0x318444), HandleError,
> DBI::db=HASH(0x3177ec)) undef (not defined)
> d

"missing left parenthesis" problem running DBD::Oracle

2002-12-17 Thread Ford, Andy
I'm getting an error running DBD::Oracle:

DBD::Oracle::db do failed: ORA-00906: missing left parenthesis (DBD ERROR:
OCIStmtExecute/Describe) at ./trace.pl line 13.

The environment is perl 5.6.1 on Solaris 8 with DBI 1.32 and DBD-Oracle
1.12.

The script that produces the above error is just:

#!/opt/perl5/bin/perl -w 
use strict;
use diagnostics;
use DBI;
use DBD::Oracle;
my ($dbname,$user,$passwd) = qw(KONFIG *** );
my $dev = $ARGV[0];
BEGIN {
  $ENV{ORACLE_HOME} = '/opt/oracle/product/8.1.6';
  $ENV{ORACLE_SID} = 'KONFIG';
}
my $dbh = DBI->connect("dbi:Oracle:KONFIG", $user, $passwd);
$dbh->do("SELECT uui FROM table device WHERE name = $dev");
$dbh->disconnect;

So it looks like I'm connecting OK, but the "do" fails.

Thanks

Andy Ford
A.G. Edwards & Sons, Inc.
[EMAIL PROTECTED]
314-955-6647



HOw bout a trace:
DBI 1.32-nothread dispatch trace level set to 5
-> DBI->connect(dbi:Oracle:KONFIG, konfigmgr, )
-> DBI->install_driver(Oracle) for solaris perl=5.006001 pid=29335
ruid=13013 euid=13013
   install_driver: DBD::Oracle version 1.12 loaded from
/opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBD/Oracle.pm
New DBI::dr (for DBD::Oracle::dr, parent=, id=)
dbih_setup_handle(DBI::dr=HASH(0x2d46b4)=>DBI::dr=HASH(0x3184c8),
DBD::Oracle::dr, 0, Null!)
dbih_make_com(Null!, DBD::Oracle::dr, 88) thr#0
dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Err, Null!) SCALAR(0x29b798)
(already defined)
dbih_setup_attrib(DBI::dr=HASH(0x3184c8), State, Null!) SCALAR(0x2d64e0)
(already defined)
dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Errstr, Null!)
SCALAR(0x29b774) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x3184c8), Debug, Null!) 0 (already
defined)
dbih_setup_attrib(DBI::dr=HASH(0x3184c8), FetchHashKeyName, Null!)
'NAME' (already defined)
<- install_driver= DBI::dr=HASH(0x2d46b4)
-> connect for DBD::Oracle::dr (DBI::dr=HASH(0x2d46b4)~0x3184c8 'KONFIG'
'konfigmgr'  HASH(0x2b5cc8))
New DBI::db (for DBD::Oracle::db, parent=DBI::dr=HASH(0x3184c8), id=)
dbih_setup_handle(DBI::db=HASH(0x31848c)=>DBI::db=HASH(0x3177ec),
DBD::Oracle::db, 2d1bf4, Null!)
dbih_make_com(DBI::dr=HASH(0x3184c8), DBD::Oracle::db, 116) thr#0
dbih_setup_attrib(DBI::db=HASH(0x3177ec), Err, DBI::dr=HASH(0x3184c8))
SCALAR(0x29b798) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x3177ec), State, DBI::dr=HASH(0x3184c8))
SCALAR(0x2d64e0) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x3177ec), Errstr,
DBI::dr=HASH(0x3184c8)) SCALAR(0x29b774) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x3177ec), Debug, DBI::dr=HASH(0x3184c8))
0 (already defined)
dbih_setup_attrib(DBI::db=HASH(0x3177ec), FetchHashKeyName,
DBI::dr=HASH(0x3184c8)) 'NAME' (already defined)
dbih_setup_attrib(DBI::db=HASH(0x3177ec), HandleError,
DBI::dr=HASH(0x3184c8)) undef (not defined)
<- connect= DBI::db=HASH(0x31848c) at
/opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line 513 via ./trace.pl
line 13
-> STORE for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'PrintError'
1)
STORE DBI::db=HASH(0x3177ec) 'PrintError' => 1
<- STORE= 1 at /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line
555 via ./trace.pl line 13
-> STORE for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'AutoCommit'
1)
<- STORE= 1 at /opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line
555 via ./trace.pl line 13
<- connect= DBI::db=HASH(0x31848c)
-> do in DBD::_::db for DBD::Oracle::db (DBI::db=HASH(0x31848c)~0x3177ec
'SELECT uui FROM table device WHERE name = 245245')
1   -> prepare for DBD::Oracle::db (DBI::db=HASH(0x3177ec)~INNER 'SELECT uui
FROM table device WHERE name = 245245' undef)
New DBI::st (for DBD::Oracle::st, parent=DBI::db=HASH(0x3177ec), id=)
dbih_setup_handle(DBI::st=HASH(0x3184bc)=>DBI::st=HASH(0x318444),
DBD::Oracle::st, 3184f8, Null!)
dbih_make_com(DBI::db=HASH(0x3177ec), DBD::Oracle::st, 208) thr#0
dbih_setup_attrib(DBI::st=HASH(0x318444), Err, DBI::db=HASH(0x3177ec))
SCALAR(0x29b798) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x318444), State, DBI::db=HASH(0x3177ec))
SCALAR(0x2d64e0) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x318444), Errstr,
DBI::db=HASH(0x3177ec)) SCALAR(0x29b774) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x318444), Debug, DBI::db=HASH(0x3177ec))
0 (already defined)
dbih_setup_attrib(DBI::st=HASH(0x318444), FetchHashKeyName,
DBI::db=HASH(0x3177ec)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x318444), HandleError,
DBI::db=HASH(0x3177ec)) undef (not defined)
dbd_st_prepare'd sql SELECT
dbd_describe SELECT (EXPLICIT, lb 80)...
OCIErrorGet after OCIStmtExecute/Describe (er1:ok): -1, 906: ORA-00906:
missing left parenthesis

!! ERROR: 906 'ORA-00906: missing left parenthesis (DBD ERROR:
OCIStmtExecute/Describe)'
1   <- prepare= undef at
/opt/perlmod/lib/site_perl/5.6.1/sun4-solaris/DBI.pm line 1220 via
./trace.pl line 14
!!

Re: DBI install under win2k

2002-12-17 Thread Kevin Diffily
Thanks for the help.  Unfortunately I am at the following impass.

1. perl -MCPAN -e "install 'RPC::PlServer'"
>> Checking if your kit is complete...
>> Looks good  
>> Writing Makefile for RPC::PlServer
>> -- OK   
>> Running make test
>>test -- NOT OK
>> Running make install
>>   make test had returned bad status, won't install without force
1. ppm
>> ppm> search plserver
>> Searching in Active Repositories
>> No matches for 'plserver'; see 'help search'.
>> ppm> search rpc 
>> Searching in Active Repositories
>>   1. DCE-Perl-RPC [0.01] Perl extension for DCE RPC protocol composer/parser



On 12/16/02 7:41 PM, "Ron Savage" <[EMAIL PROTECTED]> wrote:

> On Mon, 16 Dec 2002 16:15:29 -0500, Kevin Diffily wrote:
> 
> Hi Kevin
> 
>> I am a newbie to Perl on Windows.  I have tried to do the ppm method
> 
> Just for the record, installation help is here:
> 
> http://savage.net.au/Perl-modules.html
> --
> Ron Savage, [EMAIL PROTECTED] on 17/12/2002
> Deakin University, 221 Burwood Highway, Burwood, VIC 3125, Australia
> Phone: +61-3-9251 7441, Fax: +61-3-9251 7604
> http://www.deakin.edu.au/~rons
> 
> 

-- 
Kevin Diffily
InterNetWorkingSolutions
Enterprise Class Solutions for All Enterprises

46 Webster Street, Apt 2 Barre, VT 05641 USA
VOICE: 1.866.inetwsnet (Toll Free)
FAX:   1.888.726.9030   (Toll Free)

Sales: 
[EMAIL PROTECTED]
General Information:[EMAIL PROTECTED]
Website Hosting:[EMAIL PROTECTED]
Systems Administration Services:   [EMAIL PROTECTED]
Technical Support & Training Services:  [EMAIL PROTECTED]
Shop For it On Amazon:
http://kevin.inetws.net/amazon
AIM, Jabber, MSN, Yahoo:inetwsnet
GPG Key:5AF85391 at
wwwkeys.us.pgp.net







Re: [OT] SQL console for MSSQL

2002-12-17 Thread Michael Peppler
On Tue, 2002-12-17 at 05:16, [EMAIL PROTECTED] wrote:
> Hi,
> 
> this is a bit offtopic: I don't want to run to the server each time I want
> to check contents of some table: Is there a sqlconsole where I can just
> connect to the server via ODBC and do some SQL statements?

Go to http://www.freetds.org to get open source client libraries that
will work with MS-SQL. Then you can use ODBC or sqsh (www.sqsh.org) (or
DBI/DBD::Sybase) to connect to the MSSQL server.

Michael
-- 
Michael Peppler  Data Migrations, Inc.
[EMAIL PROTECTED] http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html



signature.asc
Description: This is a digitally signed message part


RE: [OT] SQL console for MSSQL

2002-12-17 Thread extern . Lars . Oeschey
> osql comes with the client tools.  If you have Enterprise 
> Manager, then
> you've got it.

I thought that there should be something with it... though the enterprise
manager is on the server, can I install it also locally?

Lars



Re: unexpected results with perl and mysql

2002-12-17 Thread Michael A Chase
On 17 Dec 2002 08:09:25 -0500 chad kellerman <[EMAIL PROTECTED]> wrote:

> Everyone,
> thanks for the help with the script.  I took everyone's input and
> rewrote it.
> 
> #!/usr/bin/perl

Adding -w to this line will help spot a variety of runtime errors before
they accumulate.

> $dbh = DBI->connect( "DBI:mysql:database=".$dbname, $mysqluser,
> $mysqlpasswd, {RaiseError => 1 } ) or die "Cannot connect to database:
> $!";

Errors for DBI calls are available from $h->errstr or $DBI::errstr, not $!.
In this case, since you included {RaiseError => 1}, the 'or die' never gets
activated since any errors kill the program immediately.

> #first check for failed attempts
> 
> $sth = $dbh->prepare( qq{ SELECT failedConAttempt FROM tblControl WHERE
> hostId="$hostId" } );

DBD::mysql simulates placeholders which are much safer than pasting values
into your SQL.  I don't know if '"' is a valid string delimiter for mysql.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.





RE: need help with an error

2002-12-17 Thread Mitchel, Jennifer (Jem)
Sorry all... I got the problem straitened out.  On the one machine that really matters 
to me... the tnsnames has been corrupted and part of it (including the entry i need is 
missing).  This hasn't solved the mystery on what's going wrong on some of the other 
machines... but I won't bother any of you with that.  Thanks for all your help.

-Original Message-
From: Ronald J Kimball [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 8:11 AM
To: Mitchel, Jennifer (Jem)
Cc: '[EMAIL PROTECTED]'
Subject: Re: need help with an error


On Mon, Dec 16, 2002 at 02:54:01PM -0600, Mitchel, Jennifer (Jem) wrote:
> Hi all,
> 
>   I am getting the following error out of a script.
>   DBI->connect(carespro) failed: ORA-12154: TNS:could not resolve service name (DBD 
>ERROR: OCIServerAttach) at test.cgi line 11
> Can't call method "prepare" on an undefined value at test.cgi line 16.
> 
>   I am sure the tnsnames entry is correct because i can use sqlplus and connect.
>   I am positive i have the sid, username, and password correct.

What is the value of $ENV{ORACLE_HOME} inside your script?  tnsnames.ora
should be at "$ENV{ORACLE_HOME}/network/admin/tnsnames.ora".

Ronald



RE: [OT] SQL console for MSSQL

2002-12-17 Thread Edwards, Mark (CXO)
osql comes with the client tools.  If you have Enterprise Manager, then
you've got it.

H:\>osql /?
usage: osql  [-U login id]  [-P password]
  [-S server][-H hostname]  [-E trusted connection]
  [-d use database name] [-l login timeout] [-t query timeout]
  [-h headers]   [-s colseparator]  [-w columnwidth]
  [-a packetsize][-e echo input][-I Enable Quoted
Identifiers]
  [-L list servers]  [-c cmdend][-D ODBC DSN name]
  [-q "cmdline query"]   [-Q "cmdline query" and exit]
  [-n remove numbering]  [-m errorlevel]
  [-r msgs to stderr][-V severitylevel]
  [-i inputfile] [-o outputfile]
  [-p print statistics]  [-b On error batch abort]
  [-O use Old ISQL behavior disables the following]
   batch processing
  Auto console width scaling
  Wide messages
  default errorlevel is -1 vs 1
  [-? show syntax summary]

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, December 17, 2002 7:14 AM
To: [EMAIL PROTECTED]
Subject: RE: [OT] SQL console for MSSQL
Importance: Low


> VNC or
> Odbc over Access.
> kris

hm, sounds like much overhead... I thought there's some easy Dosbox tool
like for DB2 for a few quick statements... cause even with vnc I'd have
to click me through that Enterprise Manager until i see some contents of
a table...

Lars



Re: ActivePerl + PPM on HP-UX (DBD::Informix)?

2002-12-17 Thread Henry McGuinness
Hi,

 --- Jonathan Leffler <[EMAIL PROTECTED]> wrote:
> 

> Not being aware that there was an ActiveState
> version of Perl for any 
> platform other than MS Win32, there's no way I can
> answer that.

Well, there are ActivePerls for Linux and Solaris,
though I've never made use of them. Also:

http://www.activestate.com/Corporate/Communications/Releases/Press1029188474.html

(with a link to an HP-UX software depot with the HP-UX
version)

> You only need to recompile if you don't have the
> compiler that created 
> Perl.  If you have the original compiler, there
> should be no need to 
> recompile.

I think it was a download from the HP-UX 2 years ago.

> What was the hold-up?
Not sure, I'm afraid. (Sorry this is second hand).

> Even if there's a PPM module for DBD::Informix out
> there (which I 
> doubt), you will still need the I-Connect or
> ClientSDK on the machine, 
> and preferably in the same place that the PPM
> expects. 

Ah, my ignorance of Informix I'm afraid. So compliling
is probably the way ahead. 

many thanks for your help,
Henry
  


__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com



Re: [OT] SQL console for MSSQL

2002-12-17 Thread Kris Wolff
By the way. Theere is a ADO out. Why using ODBC in a win2win net ??? You
will just need it if you work on a unix or mac box. ADO is more faster and
better to handle with.
I supose you can do Ado-Connections with Accsess Viwe the docs.

Kris



n 17.12.2002 15:23 Uhr, "Kris Wolff" <[EMAIL PROTECTED]> wrote:

> I worked a lot on mssql but I have to say, I do not know much, because I do
> not like it ! I ve I need a comercial fast sql server I buy sybase And
> not this silly slow up // hard ministratiing tool.
> Anyway if you just need the results from a mssql server table why not build
> up a perl client ? ( 5 lines )
> 
> // contect ..
> Ask for sql
> Print out results
> Loop.
> 
> ??? Isn't that easy,hm  ? If you have some time and want a nicer tool in the
> future you can build a tk araund this...
> 
> I build up a lot of these litle helpers, but sorry I can't send because I am
> not in my office this week. But I am sure you can do it by your own, are you
> ?
> 
> kris 
> 
> 
> On 17.12.2002 15:13 Uhr, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> 
>>> VNC or
>>> Odbc over Access.
>>> kris
>> 
>> hm, sounds like much overhead... I thought there's some easy Dosbox tool
>> like for DB2 for a few quick statements... cause even with vnc I'd have to
>> click me through that Enterprise Manager until i see some contents of a
>> table...
>> 
>> Lars
> 




Re: Inserting DoubleQuotes using Placeholders

2002-12-17 Thread Ronald J Kimball
On Tue, Dec 17, 2002 at 09:11:22AM -0500, Chris Faust wrote:
> Hello All,
> 
> This may not be a DBI problem, but I've haven't been able to turn up any
> good info so I'm giving the list a shot..
> 
> The problem is with double quotes, in short I have a HTML form text box to
> take a user inputted description which gets saved into a mySql table into
> the following field.

> The problem is if a user uses double quotes within that description then
> everything from the first double quote until the end is wiped out
> (everything else is inserted or updated)..
> 
> I am using placeholders and I thought that this was the exact reason to use
> them (so there are no quoting issues), for example

I would guess that you are passing the values through hidden fields in
another HTML page before inserting them into the database, and failing to
escape the values there.  The behavior you describe would not come from
using placeholders in DBI.

You can escape the values for HTML with ampersands, e.g.:

s/&/&/g;
s/"/"/g;
s//>/g;

If you use the CGI module to produce the HTML, it will handle this escaping
for you.

Ronald



Re: Inserting DoubleQuotes using Placeholders

2002-12-17 Thread Hardy Merrill
Not sure if this is the answer, but it might be - see below.

Chris Faust [[EMAIL PROTECTED]] wrote:
> Hello All,
> 
> This may not be a DBI problem, but I've haven't been able to turn up any
> good info so I'm giving the list a shot..
> 
> The problem is with double quotes, in short I have a HTML form text box to
> take a user inputted description which gets saved into a mySql table into
> the following field.
> 
> | Field   | Type | Null | Key | Default | Extra
> |
> +-+--+--+-+-+---
> -+
> | ListingDescription  | text | YES  | | NULL|
> |
> 
> 
> The problem is if a user uses double quotes within that description then
> everything from the first double quote until the end is wiped out
> (everything else is inserted or updated)..
> 
> I am using placeholders and I thought that this was the exact reason to use
> them (so there are no quoting issues), for example
> 
> $sth = $db->prepare("Update table set ListingDescription = ?")

Instead of bounding your prepare with double quotes, try using
qq instead, like this:

  $sth = $db->prepare(qq{
 update table
set ListingDescription = ?
  }) || die "Error with prepare: $DBI::errstr";

Since there aren't any variables being interpolated within the
sql, you could even substitute a "q" for the "qq".

And, aren't you missing a WHERE clause in that update?

HTH.

-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.

> $sth->execute($form_value{'description'}).
> 
> Should I just do a search and replace on that val and escape any double
> quotes?
> ($val =~ s/"/\\"/g)
> Or is there something I'm missing?
> 
> I guess I need to go back now and start testing things like single quotes
> and whatnot to see if there are other problem with any other chars..
> 
> Thanks in advance for any info.
> -Chris



Re: [OT] SQL console for MSSQL

2002-12-17 Thread Kris Wolff
I worked a lot on mssql but I have to say, I do not know much, because I do
not like it ! I ve I need a comercial fast sql server I buy sybase And
not this silly slow up // hard ministratiing tool.
Anyway if you just need the results from a mssql server table why not build
up a perl client ? ( 5 lines )

// contect ..
Ask for sql
Print out results
Loop.

??? Isn't that easy,hm  ? If you have some time and want a nicer tool in the
future you can build a tk araund this...

I build up a lot of these litle helpers, but sorry I can't send because I am
not in my office this week. But I am sure you can do it by your own, are you
?

kris 


On 17.12.2002 15:13 Uhr, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

>> VNC or
>> Odbc over Access.
>> kris
> 
> hm, sounds like much overhead... I thought there's some easy Dosbox tool
> like for DB2 for a few quick statements... cause even with vnc I'd have to
> click me through that Enterprise Manager until i see some contents of a
> table...
> 
> Lars




Inserting DoubleQuotes using Placeholders

2002-12-17 Thread Chris Faust
Hello All,

This may not be a DBI problem, but I've haven't been able to turn up any
good info so I'm giving the list a shot..

The problem is with double quotes, in short I have a HTML form text box to
take a user inputted description which gets saved into a mySql table into
the following field.

| Field   | Type | Null | Key | Default | Extra
|
+-+--+--+-+-+---
-+
| ListingDescription  | text | YES  | | NULL|
|


The problem is if a user uses double quotes within that description then
everything from the first double quote until the end is wiped out
(everything else is inserted or updated)..

I am using placeholders and I thought that this was the exact reason to use
them (so there are no quoting issues), for example

$sth = $db->prepare("Update table set ListingDescription = ?")
$sth->execute($form_value{'description'}).

Should I just do a search and replace on that val and escape any double
quotes?
($val =~ s/"/\\"/g)
Or is there something I'm missing?

I guess I need to go back now and start testing things like single quotes
and whatnot to see if there are other problem with any other chars..

Thanks in advance for any info.
-Chris





RE: [OT] SQL console for MSSQL

2002-12-17 Thread extern . Lars . Oeschey
> VNC or
> Odbc over Access.
> kris

hm, sounds like much overhead... I thought there's some easy Dosbox tool
like for DB2 for a few quick statements... cause even with vnc I'd have to
click me through that Enterprise Manager until i see some contents of a
table...

Lars



Re: need help with an error

2002-12-17 Thread Ronald J Kimball
On Mon, Dec 16, 2002 at 02:54:01PM -0600, Mitchel, Jennifer (Jem) wrote:
> Hi all,
> 
>   I am getting the following error out of a script.
>   DBI->connect(carespro) failed: ORA-12154: TNS:could not resolve service name (DBD 
>ERROR: OCIServerAttach) at test.cgi line 11
> Can't call method "prepare" on an undefined value at test.cgi line 16.
> 
>   I am sure the tnsnames entry is correct because i can use sqlplus and connect.
>   I am positive i have the sid, username, and password correct.

What is the value of $ENV{ORACLE_HOME} inside your script?  tnsnames.ora
should be at "$ENV{ORACLE_HOME}/network/admin/tnsnames.ora".

Ronald



Re: [OT] SQL console for MSSQL

2002-12-17 Thread Kris Wolff
Ah sorry mssql ...

2 ways:
VNC or
Odbc over Access.
Or a perl client :-)))

I always done the vnc thing.

kris


On 17.12.2002 15:08 Uhr, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

>> Mysql/bin/mysql -h ipadress of host -u username
>> kris
> 
> of course I do that with my Linux-Box and MySql. Problem here is, that MSSQL
> usually runs on Windows machines without ssh or anything else ;)
> 
> Lars




RE: [OT] SQL console for MSSQL

2002-12-17 Thread extern . Lars . Oeschey
> Mysql/bin/mysql -h ipadress of host -u username
> kris

of course I do that with my Linux-Box and MySql. Problem here is, that MSSQL
usually runs on Windows machines without ssh or anything else ;)

Lars



Re: [OT] SQL console for MSSQL

2002-12-17 Thread Kris Wolff
Why not direkt ??
Via ssh, or
Phpmyadmin ( webbased )
Or just
Mysql/bin/mysql -h ipadress of host -u username

kris


On 17.12.2002 14:16 Uhr, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> Hi,
> 
> this is a bit offtopic: I don't want to run to the server each time I want
> to check contents of some table: Is there a sqlconsole where I can just
> connect to the server via ODBC and do some SQL statements?
> 
> regards, Lars




Re: need help with an error

2002-12-17 Thread darren chamberlain
* Mitchel, Jennifer (Jem) <[EMAIL PROTECTED]> [2002-12-17 04:19]:
> Hi all,
> 
>   I am getting the following error out of a script.
>   DBI->connect(carespro) failed: ORA-12154: TNS:could not resolve
>   service name (DBD ERROR: OCIServerAttach) at test.cgi line 11 Can't
>   call method "prepare" on an undefined value at test.cgi line 16.
> 
>   I am sure the tnsnames entry is correct because i can use sqlplus
>   and connect.  I am positive i have the sid, username, and password
>   correct.
> 
>   Interesting if I take this code and put it on the machine where the
>   db i'm trying to connect is... it works ok.
> 
>   Has anyone ever seen that?  Does anyone know what I can do about it?

It sounds like the DNS name of the server you are referencing in the
connect() can't be found.

You are checking the return value of connect(), right?

  my $dbh = DBI->connect($dsn, $user, $pass, $attr)
  or die $DBI::err;

(darren)

-- 
Once you eliminate the impossible, whatever remains, no matter how
improbable, must be the truth.
-- Sherlock Holmes



[OT] SQL console for MSSQL

2002-12-17 Thread extern . Lars . Oeschey
Hi,

this is a bit offtopic: I don't want to run to the server each time I want
to check contents of some table: Is there a sqlconsole where I can just
connect to the server via ODBC and do some SQL statements?

regards, Lars



RE: unexpected results with perl and mysql

2002-12-17 Thread chad kellerman
Everyone,
thanks for the help with the script.  I took everyone's input and
rewrote it.

#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my( $dbname ) = "BACKUP";
my( $mysqluser ) = "bob";
my( $mysqlpasswd ) = "bobspasswd";
my( $dbh, $sth, $rc );
my( @failedCon, $var, $name, @names );

#these variables will be passed to subroutine in main program.
my( $hostId ) = "543";
my( $biggyFlag ) = "0";
my( $hostDirFlag ) = "1";


$dbh = DBI->connect( "DBI:mysql:database=".$dbname, $mysqluser,
$mysqlpasswd, {RaiseError => 1 } ) or die "Cannot connect to database:
$!";

#first check for failed attempts

$sth = $dbh->prepare( qq{ SELECT failedConAttempt FROM tblControl WHERE
hostId="$hostId" } );
$sth->execute ();
$sth->bind_columns( \$var );
while  ( $sth->fetch ) { 

push @failedCon, $var;

}
$sth->finish ();

print "backup failed to connect to $hostId: $failedCon[0] times.\n";


#grab information

if ( $failedCon[0] == 0 ) {
$sth = $dbh->prepare ( q{
SELECT name FROM tblProcess
WHERE biggy_flag="$biggyFlag" AND hostId="$hostId" AND
hostDirFlag="$hostDirFlag"
} );
$sth->execute ();
$sth->bind_columns( \$name );
while ( $sth->fetchrow_array () ) {
push @names, $name;
}
$sth->finish ();
print "Looks like a first: @names\n";
}else{
$sth = $dbh->prepare ( q{
SELECT name FROM tblProcess
WHERE biggy_flag="$biggyFlag" AND hostId="$hostId" AND
hostDirFlag="$hostDirFlag" AND status="In-Progress" OR status="Queued"
} );
$sth->execute ();
$sth->bind_columns( \$name );
while ( $sth->fetchrow_array () ){
push @names, $name; 
}
$sth->finish ();
print "Looks Like we have been here before:@names\n";
}

$rc = $dbh->disconnect;
exit (0);

Everything works as it should.  Thanks again


chad








signature.asc
Description: This is a digitally signed message part


need help with an error

2002-12-17 Thread Mitchel, Jennifer (Jem)
Hi all,

  I am getting the following error out of a script.
  DBI->connect(carespro) failed: ORA-12154: TNS:could not resolve service name (DBD 
ERROR: OCIServerAttach) at test.cgi line 11
Can't call method "prepare" on an undefined value at test.cgi line 16.

  I am sure the tnsnames entry is correct because i can use sqlplus and connect.
  I am positive i have the sid, username, and password correct.

  Interesting if I take this code and put it on the machine where the db i'm trying to 
connect is... it works ok.

  Has anyone ever seen that?  Does anyone know what I can do about it?

Thank you!
Jem