Having problems with DBI, Larry Wall told me to ask you guys

2006-05-17 Thread Joe McTigue
Hi Any Kind Person,

 

I am currently getting the following error message and was wondering if
you could help?

If you can, here's the scenario:  The code below is what I'm trying to
accomplish: reading a file

consisting of insert, update and delete statements and sending them
through queries. 

But for the past several days now and can't seem to figure it out, 

I've been getting the following error now:

# ERROR FOLLOWS:

starting file: DELETE.sql

DBI connect('nameofdb','username',...) failed: ORA-24315: illegal
attribute type (DBD ERROR: OCIAttrGet OCI_ATTR_ENV_CHARSET_ID) at
perlscript.pl line 463

Can't connect to database:ORA-24315: illegal attribute type (DBD ERROR:
OCIAttrGet OCI_ATTR_ENV_CHARSET_ID) at perlscript.pl line 463.

# END OF ERROR ###

 

# CODE SEGMENT FOLLOWS #

my $INPUT_SQL = FileHandle-new(cat ${working_file} |) or die
(Can not open ${working_file}: $!\n);



next line is line : 463

my $dbh = DBI-connect( dbi:Oracle:$nameofdb, $username,
$password ) || die Can't connect to database: . DBI-errstr();

 

while ( my $line = $INPUT_SQL-getline() )

{

   chomp( $line );

 

   my $sth = $dbh-prepare( $line ) or die Can't prepare SQL
statement.\n;

 

   $sth-execute() or die Can't execute SQL statement.\n;

   

}

$INPUT_SQL-close();

 

$dbh-disconnect() or warn Error disconnecting: \n;

 

# END CODE SEGMENT ##

 

Any help would be incredibly wonderful at this point.

 

 

 

Regards,

Joseph P. McTigue

CBC Innovis, QA Department

[EMAIL PROTECTED]

(614) 538-6032

 



Re: Having problems with DBI, Larry Wall told me to ask you guys

2006-05-17 Thread Jonathan Leffler

On 5/17/06, Joe McTigue [EMAIL PROTECTED] wrote:


[...]
I am currently getting the following error message and was wondering if
you could help? [...]

I've been getting the following error now:
[...]

DBI connect('nameofdb','username',...) failed: ORA-24315: illegal
attribute type (DBD ERROR: OCIAttrGet OCI_ATTR_ENV_CHARSET_ID) at
perlscript.pl line 463

Can't connect to database:ORA-24315: illegal attribute type (DBD ERROR:
OCIAttrGet OCI_ATTR_ENV_CHARSET_ID) at perlscript.pl line 463.




OK - so you can't connect.  Modify the script to ignore the file stuff - get
just the connect working.

What's the value of $nameofdb?  $username?  $password?

Is your Oracle environment set correctly?

Have you ever connected to that DB?

Have you ever read:

http://www.catb.org/~esr/faqs/smart-questions.html





next line is line : 463

my $dbh = DBI-connect( dbi:Oracle:$nameofdb, $username,
$password ) || die Can't connect to database: . DBI-errstr();



Aren't you supposed to use 'or' rather than '||' here?



Granted, it is unlikely to be critical here, but standard recommended
information would include platform (machine and o/s), plus versions of Perl,
DBI, DBD::Oracle (for you; DBD::WhatEver when using another driver), and
sometimes the underlying DBMS - or, even the DBMS and DBMS API versions.


--
Jonathan Leffler [EMAIL PROTECTED]  #include disclaimer.h
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
I don't suffer from insanity - I enjoy every minute of it.