Re: DBD::mysql and mysql_use_result
Tim Bunce wrote: Does the binary protocol allow the link to be used for other actions while there are still rows being sent to the client? If not "use result" can't be the default as too much existing code would break. My experementation would suggest that it doesn't - if you turn use_result on with the existing driver than then try to do a nested prepare/execute/fetch within the outer loop, to get an error - I can't remember the exact wording, but the gist is 'You can't do that now'. -- Alan Burlison --
Re: DBD::Sybase 1.04.6 -- Production quality?
> From: amonotod <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 05:33:16 GMT > > > From: Michael Peppler <[EMAIL PROTECTED]> > > Date: 2004/08/13 Fri AM 07:50:56 GMT > > > > space defined, or "trunc. log on checkpoint" turned on? > > Might you know how to control how often the checkpoints happen? Okay, never mind. I turned the option back off, since I can't be certain it will be on when the customer is using my script, and added this to the bottom of the table population, to be executed after each table is populated: if (uc($arg_db_type) eq "SYBASE") { my $sqlStatemnt = "dump transaction $arg_use_db with truncate_only"; my $sth = $dbh->prepare($sqlStatemnt); unless ($sth->execute) { print LOGFILE "errors: $dbh->errstr \n"; print LOGFILE "\nErrors were encountered during log truncation, exiting...\n"; } } Thank you for pointing me in the right direction... I appreciate it, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
RE: SQL- Insert problem
Ron/Amonotod/Ronald/Merrill Its working !!! Thank you very much for all your time and extended help. It was my mistake that I was unaware and caused this problem. I had a perl script that would insert data into the table. Some columns in this table had unique value constraint so I had to delete values from the table when it was updated by the script (I had changed the name of the table and it used to update the table for the first time only). To delete the table I used TOAD and wrote a query "delete from oper_query" and it did delete every rows. Then I use to go back to unix box and try to run my script and it used to hang. Here is the problem, I did not COMMIT my delete session in TOAD and that was the culprit. After I realized my mistake it started working. Also binding columns is working properly when there is no value in the variable. I learned many new things today from all your experience and my mistakes. May be today is Friday and it might be one of the reasons :-) Thanks again. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 3:19 PM To: amonotod; [EMAIL PROTECTED] Cc: Ronald J Kimball; Hardy Merrill Subject: RE: SQL- Insert problem Correct, but he he building dynamic SQL. The resulting insert statement's values clause looks like (v1,v1,,v4...); the problem is the ",,". This is why I suggested to use bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: amonotod [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 2:04 PM To: [EMAIL PROTECTED] Cc: Ronald J Kimball; 'Hardy Merrill' Subject: RE: SQL- Insert problem > From: "Ronald J Kimball" <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 05:59:39 GMT > > Hardy Merrill [mailto:[EMAIL PROTECTED] wrote: > > > > Just in case the op doesn't make the connection, he needs to test his > > variables for undef before the execute, and if one is undef, then put > > Why does he need to do that? I have never had to test my bind values for > defined-ness when using placeholders. An undef in Perl becomes a NULL in > Oracle, and vice versa. Programming the Perl DBI, Page 221, paragragh 1, sentence 3: "Undefined values or 'undef' can be used to indicate null values." > Ronald HTH, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_| This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
RE: SQL- Insert problem
Correct, but he he building dynamic SQL. The resulting insert statement's values clause looks like (v1,v1,,v4...); the problem is the ",,". This is why I suggested to use bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: amonotod [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 2:04 PM To: [EMAIL PROTECTED] Cc: Ronald J Kimball; 'Hardy Merrill' Subject: RE: SQL- Insert problem > From: "Ronald J Kimball" <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 05:59:39 GMT > > Hardy Merrill [mailto:[EMAIL PROTECTED] wrote: > > > > Just in case the op doesn't make the connection, he needs to test his > > variables for undef before the execute, and if one is undef, then put > > Why does he need to do that? I have never had to test my bind values for > defined-ness when using placeholders. An undef in Perl becomes a NULL in > Oracle, and vice versa. Programming the Perl DBI, Page 221, paragragh 1, sentence 3: "Undefined values or 'undef' can be used to indicate null values." > Ronald HTH, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_| This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
RE: SQL- Insert problem
> From: "Ronald J Kimball" <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 05:59:39 GMT > > Hardy Merrill [mailto:[EMAIL PROTECTED] wrote: > > > > Just in case the op doesn't make the connection, he needs to test his > > variables for undef before the execute, and if one is undef, then put > > Why does he need to do that? I have never had to test my bind values for > defined-ness when using placeholders. An undef in Perl becomes a NULL in > Oracle, and vice versa. Programming the Perl DBI, Page 221, paragragh 1, sentence 3: "Undefined values or 'undef' can be used to indicate null values." > Ronald HTH, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
RE: SQL- Insert problem
See below ... - Ron Reidy Senior DBA Array BioPharma, Inc. 303.386.1480 -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:49 PM To: [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Here is the code if it helps. I do not know how to run trace 10046 but I have put output from V$session_wait for my session. [Reidy, Ronald] Not enough. Do "alter session set events '10046 trace name context forever, level 8'" after your connection. my $dbh = $db->connect("$graph_fab"); $sth1 = $dbh->prepare(qq{insert into temp values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}) or die"Cannot prepare sql:$DBI::errstr\n"; foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ my $string=$H_CNT_BY_PGM{$type}{$pgm}; ($dev_type_err,$test_type_err,$lot_type_err,$temp_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_lot_type_err,$rmenu_temp_type_err)=split(/,/,$string); print "Values to insert: $mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err\n\n"; $sth1->execute($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err) or die"Cannot execute with values:$DBI::ERRSTR"; }#foreach }#foreach print "Finished Inserting in temp\n"; $sth1->finish(); $dbh->disconnect(); select * from v$session_wait where sid=21 SID SEQ# EVENT P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_TIME SECONDS_IN_WAIT STATE 21 59 enqueue name|mode 1415053316 54580004 id1 262176 00040020 id2 417280 00065E00 0 141 WAITING I will try to contact my DBA and get the 10046 trace but it will take some time. If its short and simple and if some one is willing to explain I can try to do it myself. [Reidy, Ronald] Did you commit before trying to rename the table? -- Currently I am just testing to see if my code works to populate the table. I did not change the name or did any commit. After I hit 'ok' button it populates all the data in db without any problems. I delete all the data "delete from temp" and then try to run the sql since there are some PK and unique value constraints. [Reidy, Ronald] Get out of toad and run this. Urmil This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
RE: SQL- Insert problem
> From: "Shah, Urmil" <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 07:48:44 GMT > > $sth1 = $dbh->prepare(qq{insert into temp values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}) or > die"Cannot prepare sql:$DBI::errstr\n"; My understanding was that placeholders must have column names associated with them, so I dont' think that would work... HTH, and HINW, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_| Here is the code if it helps. I do not know how to run trace 10046 but I have put output from V$session_wait for my session. my $dbh = $db->connect("$graph_fab"); $sth1 = $dbh->prepare(qq{insert into temp values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}) or die"Cannot prepare sql:$DBI::errstr\n"; foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ my $string=$H_CNT_BY_PGM{$type}{$pgm}; ($dev_type_err,$test_type_err,$lot_type_err,$temp_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_lot_type_err,$rmenu_temp_type_err)=split(/,/,$string); print "Values to insert: $mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err\n\n"; $sth1->execute($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err) or die"Cannot execute with values:$DBI::ERRSTR"; }#foreach }#foreach print "Finished Inserting in temp\n"; $sth1->finish(); $dbh->disconnect(); select * from v$session_wait where sid=21 SID SEQ# EVENT P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_TIME SECONDS_IN_WAIT STATE 21 59 enqueue name|mode 1415053316 54580004 id1 262176 00040020 id2 417280 00065E00 0 141 WAITING I will try to contact my DBA and get the 10046 trace but it will take some time. If its short and simple and if some one is willing to explain I can try to do it myself. [Reidy, Ronald] Did you commit before trying to rename the table? -- Currently I am just testing to see if my code works to populate the table. I did not change the name or did any commit. After I hit ‘ok’ button it populates all the data in db without any problems. I delete all the data “delete from temp” and then try to run the sql since there are some PK and unique value constraints. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 2:06 PM To: Shah, Urmil; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem See below ... - Ron Reidy Senior DBA Array BioPharma, Inc. 303.386.1480 -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:02 PM To: Reidy, Ron; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Ok Here is the main problem. When I do bind columns, i.e prepare my sql statement outside the foreach loop and inside the loop when I pass on the parameters ( even the empty ones without any values) i found that it hangs. [Reidy, Ronald] Did you run a 10046 trace for the session? It will be virtaully impossible to determine what the problem is without this. I went to TOAD to see what the problem is and did any data get loaded in this table and when I tried to rename that table it gave me the following error. As soon as I hit ‘ok’ button , the looping and inserting from my unix box gets completed successfully and data is inserted (empty variables remain as they are). [Reidy, Ronald] Did you commit before trying to rename the table? Also this db is not heavily used and my sql query is also very simple. I am not sure what causes the LOCK and NOWAIT in oracle. I have never had this problem before and all resources seem to be in normal condition. [Reidy, Ronald] It means a process has some sort of a lock on the table (or one of it's indexes) and another process is trying to obtain a lock of similar strength. The NOWAIT means the statement was issued withou the NOWAIT clause. Regards, Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 12:35 PM To: Shah, Urmil; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You need to ensure your variables have values. In the case where they are undef, assigning them the empty string ("") should be suf
RE: SQL- Insert problem
Here is the code if it helps. I do not know how to run trace 10046 but I have put output from V$session_wait for my session. my $dbh = $db->connect("$graph_fab"); $sth1 = $dbh->prepare(qq{insert into temp values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}) or die"Cannot prepare sql:$DBI::errstr\n"; foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ my $string=$H_CNT_BY_PGM{$type}{$pgm}; ($dev_type_err,$test_type_err,$lot_type_err,$temp_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_lot_type_err,$rmenu_temp_type_err)=split(/,/,$string); print "Values to insert: $mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err\n\n"; $sth1->execute($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err) or die"Cannot execute with values:$DBI::ERRSTR"; }#foreach }#foreach print "Finished Inserting in temp\n"; $sth1->finish(); $dbh->disconnect(); select * from v$session_wait where sid=21 SID SEQ# EVENT P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_TIME SECONDS_IN_WAIT STATE 21 59 enqueue name|mode 1415053316 54580004 id1 262176 00040020 id2 417280 00065E00 0 141 WAITING I will try to contact my DBA and get the 10046 trace but it will take some time. If its short and simple and if some one is willing to explain I can try to do it myself. [Reidy, Ronald] Did you commit before trying to rename the table? -- Currently I am just testing to see if my code works to populate the table. I did not change the name or did any commit. After I hit ‘ok’ button it populates all the data in db without any problems. I delete all the data “delete from temp” and then try to run the sql since there are some PK and unique value constraints. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 2:06 PM To: Shah, Urmil; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem See below ... - Ron Reidy Senior DBA Array BioPharma, Inc. 303.386.1480 -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:02 PM To: Reidy, Ron; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Ok Here is the main problem. When I do bind columns, i.e prepare my sql statement outside the foreach loop and inside the loop when I pass on the parameters ( even the empty ones without any values) i found that it hangs. [Reidy, Ronald] Did you run a 10046 trace for the session? It will be virtaully impossible to determine what the problem is without this. I went to TOAD to see what the problem is and did any data get loaded in this table and when I tried to rename that table it gave me the following error. As soon as I hit ‘ok’ button , the looping and inserting from my unix box gets completed successfully and data is inserted (empty variables remain as they are). [Reidy, Ronald] Did you commit before trying to rename the table? Also this db is not heavily used and my sql query is also very simple. I am not sure what causes the LOCK and NOWAIT in oracle. I have never had this problem before and all resources seem to be in normal condition. [Reidy, Ronald] It means a process has some sort of a lock on the table (or one of it's indexes) and another process is trying to obtain a lock of similar strength. The NOWAIT means the statement was issued withou the NOWAIT clause. Regards, Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 12:35 PM To: Shah, Urmil; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You need to ensure your variables have values. In the case where they are undef, assigning them the empty string ("") should be sufficient. If this statement still hangs when doing this, you need to run a 10046 trace for your session to see what is going on (see your DBA for this). - Ron Reidy Senior DBA Array BioPharma, Inc. 303.386.1480 This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distri
Re: SQL- Insert problem
> From: amonotod <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 07:29:35 GMT > Note that I tested with MSSQL, but Well, yes, I did test with MSSQL, but as you can see from the DBI connection string, I also tested with Oracle 9i... :-) amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
Re: SQL- Insert problem
> From: "Shah, Urmil" <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 04:42:54 GMT > Need help in trying to insert an sql statement. As everyone else has been saying, you need to use placeholders. See my script below... Note that I tested with MSSQL, but > Regards, > Urmil Regards, amonotod #!perl -w use strict; eval ("use DBI"); if ($@) { die "This system does not have the DBI installed\n"; } my ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err, $test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err, $rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err); # Note that I have declared the variables, but not assigned any value to them... my %H_CNT_BY_PGM; my $olimit = 10; while ($olimit > 0) { my $type = ""; my $typeLen = rand(10)+1; while ($typeLen > 0) { $type .= chr((rand(26)+97)); $typeLen--;} #print "$type \n"; my $ilimit = 10; while ($ilimit > 0) { my $pgm = ""; my $pgmLen = rand(10)+1; while ($pgmLen > 0) { $pgm .= chr((rand(26)+97)); $pgmLen--;} #print "\t$pgm \n"; $H_CNT_BY_PGM{$type}{$pgm} = 1; $ilimit--; } $olimit--; } my $dbh = DBI->connect( "dbi:Oracle:host=ORADEV9I;sid=ORADEV9I", 'scott', 'tiger', {RaiseError => 0, AutoCommit => 1} ); my $sqlStatement = "DROP TABLE OPER_QUERY"; my $sth = $dbh->prepare($sqlStatement) or die("Cannot prepare sql:$dbh->errstr\n"); unless ($sth->execute) { print "errors: $dbh->errstr \n"; print "\nErrors were encountered during table drop, exiting...\n"; } $sqlStatement =errstr\n"); unless ($sth->execute) { print "errors: $dbh->errstr \n"; print "\nErrors were encountered during table create, exiting...\n"; } $sqlStatement = "insert into OPER_QUERY (end_date,site,tester_type,program,". "total,oper_yes,rmenu_yes,opr_dev_type,opr_test_type,". "opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type,". "rmenu_temp_type,rmenu_lot_type) values (?,?,?,?,?,?,?,?,?,". "?,?,?,?,?,?)"; $sth = $dbh->prepare($sqlStatement) or die("Cannot prepare sql:$dbh->errstr\n"); foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth->execute($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err, $test_type_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err, $rmenu_test_type_err,$rmenu_temp_type_err,$rmenu_lot_type_err) or die"Cannot send the data... $dbh->errstr\n"; } } -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
RE: SQL- Insert problem
See below ... - Ron Reidy Senior DBA Array BioPharma, Inc. 303.386.1480 -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:02 PM To: Reidy, Ron; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Ok Here is the main problem. When I do bind columns, i.e prepare my sql statement outside the foreach loop and inside the loop when I pass on the parameters ( even the empty ones without any values) i found that it hangs. [Reidy, Ronald] Did you run a 10046 trace for the session? It will be virtaully impossible to determine what the problem is without this. I went to TOAD to see what the problem is and did any data get loaded in this table and when I tried to rename that table it gave me the following error. As soon as I hit 'ok' button , the looping and inserting from my unix box gets completed successfully and data is inserted (empty variables remain as they are). [Reidy, Ronald] Did you commit before trying to rename the table? Also this db is not heavily used and my sql query is also very simple. I am not sure what causes the LOCK and NOWAIT in oracle. I have never had this problem before and all resources seem to be in normal condition. [Reidy, Ronald] It means a process has some sort of a lock on the table (or one of it's indexes) and another process is trying to obtain a lock of similar strength. The NOWAIT means the statement was issued without the NOWAIT clause. Regards, Urmil This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
Re: SQL- Insert problem
I would highly recommend using the -w option (and 'use strict;' if you are not already). I'd also recommend pulling the prepare out of the loop - If you are using bind variables you shouldn't need to prepare the statement every time through the loop. The hanging behavior is odd. I (and presumably many people on the list) have used bind variables for years without trouble. It may be that -w and 'use strict;' will give you helpful info; these were both required rules (as much as I could enforce them) back in my days of iron-fisted DBA. --Chris On Aug 13, 2004, at 1:28 PM, Shah, Urmil wrote: Ok I tried to use method 3 and as I said it hangs. Since it's a dynamic sql some variables are undefined and they do not have any value, now if they don't have any value is it possible that DBI/Oracle will interpret as empty values ? else I have to check the values of each variable and then hardcode to null if there is no value. The print statement shows what is going to be populated. If it is empty I want them to be empty. My print statement and Trace output: Values to insert: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49ea08) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option <- prepare('insert into OPER_QUERY values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' CODE)= DBI::st=HASH(0x49eaa4) at oper_query.pl line 352 DBI::db=HASH(0x49ea08) trace level set to 2 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option <- trace= 1 at oper_query.pl line 353 ^C!! ERROR: 1013 'ORA-01013: user requested cancel of current operation (DBD: oexec error)' <- execute('08/12/04' 'DMOS5' ...)= undef at oper_query.pl line 354 DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexec error) at oper_query.pl line 354. DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexec error) at oper_query.pl line 354. <- DESTROY= undef -> DESTROY for DBD::Oracle::db (DBI::db=HASH(0x49ea08)~INNER) <- DESTROY= undef during global destruction Regards, Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 12:16 PM To: Kong, Alan; Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem He should use bind variables (method 3). - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Kong, Alan [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:13 AM To: Shah, Urmil; Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Try the mothed 2 with non-numeric fields single-quoted. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:07 PM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreac
RE: SQL- Insert problem
>>> "Ronald J Kimball" <[EMAIL PROTECTED]> 08/13/04 01:59PM >>> Hardy Merrill [mailto:[EMAIL PROTECTED] wrote: > > Just in case the op doesn't make the connection, he needs to test his > variables for undef before the execute, and if one is undef, then put > null("") in it, something like this: > > if (!defined($a)) {$a = "";} > if (!defined($b)) {$b = "";} >... and so on - you get the idea... > $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) > ) > $sth->execute($a,$b,$c,$d,...$x) or die; Why does he need to do that? I have never had to test my bind values for defined-ness when using placeholders. An undef in Perl becomes a NULL in Oracle, and vice versa. Ronald I have to plead ignorance - I thought his problem was caused by one or more the variables (being passed to placeholders) being undefined. Sorry, I must not have read his post well enough that included the actual error(s). Hardy
RE: :ODBC, MSSQL, output params
Jenda, It could be a bug. Can you wrap up a quick test case and I'll trace it through? Regards, Jeff > > I'm calling some stored procedures using DBI 1.32, DBD::ODBC 1.07 and > Perl v5.8.0 (ActivePerl build 805) running on Win2kServer SP4 using > MS SQL 2000. > > Am I supposed to initialize the variables I pass to > bind_param_inout()? > > I'm using code like this to prepare and call the stored procedures > and fetch the OUTPUT parameters: > > sub prepare_sps { > $sp{GetLocationInfo_p} > = $db->prepare('EXEC dbo.GetLocationInfo '. > join(', ',('?') x 5)); > # parameters 2-5 are OUTPUT! > { > my ($JobCity, $JobState, $JobCountry, $JobZIP) > = ( " "x 50, " "x 50, " ", " "x 5); > my $sp = $sp{GetLocationInfo_p}; > $sp->bind_param_inout(2, \$JobCity, 50, > DBI::SQL_VARCHAR); > $sp->bind_param_inout(3, \$JobState, 50, > DBI::SQL_VARCHAR); > $sp->bind_param_inout(4, \$JobCountry, 2, > DBI::SQL_CHAR); > $sp->bind_param_inout(5, \$JobZIP, 5, DBI::SQL_CHAR); > > $sp{GetLocationInfo} = sub { > $sp->bind_param(1, $_[0]); > $sp->execute(); > $_[1] = $JobCity; > $_[2] = $JobState; > $_[3] = $JobCountry; > $_[4] = $JobZIP; > s/^\s+//,s/\s+$// for ($_[1..4]); > } > }; > ... > } > ... > > $sp{GetLocationInfo}->($jobLocationId, $JobCity, $JobState, > $JobCountry, $JobZIP); > > The stored proc looks like this: > > CREATE PROCEDURE dbo.GetMonsterLocationInfo( > @LocationID Int, > @City varchar(50) OUTPUT, > @State varchar(50) OUTPUT, > @Country char(2) OUTPUT, > @Zip char(5) OUTPUT > ) AS > BEGIN > SELECT @Zip = ZipCode, @State = State, @Country = > Country, @City = > MappedCity > FROM dbo.LocationLookup WITH (NOLOCK) >WHERE ID = @LocationID > END > > The problem is that if I do not initialize the $JobXxxx variables > with those spaces: > > my ($JobCity, $JobState, $JobCountry, $JobZIP) > = ( " "x 50, " "x 50, " ", " "x 5); > > I only get the first letters of the values. Once I do initialize the > variables I do get the right and complete values even in a loop, even > if the value in a later iteration is longer than the one in a > previous. > I do get the same incorrect results if the variables are undef or "". > > Why is that? Is this something I missed in the docs? Or is it a bug > in DBD::ODBC? Or ...? > > Thanks, Jenda > > == [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == > I wonder why the whole chemistry industry ignores > computer bugs. We all would gladly pay big bucks > for a functional insecticide. >
Re: Teradata DBD fix for use with TD V2R5.1
Douglas Marsh wrote: Starting with Teradata V2R5.1 by default logons are encrypted. This broke the venerable Teradata DBD V 1.13. You can turn off the requirement for the encryption at the server, but they tend to look at you funny when you tell them you want to muck about on their big bucks server because your Perl scripts stopped working! Is anyone working on a fix? I know they are using Blowfish encryption: http://www.schneier.com/blowfish.html and that for now at least it's just the logon data that is encrypted. With the next major release of TD the plan is to encrypt everything on the network stream. I'd like to see this working again, is anybody working on it? Doug It will soon be available for the commerical version via a native CLI2 adapter. I am unlikely to have spare resources to apply a fix for the freely available version in the near future, as the source bases of the 2 versions are significantly out of alignment. Regards, Dean Arnold Presicient Corp. www.presicient.com
RE: SQL- Insert problem
Hardy Merrill [mailto:[EMAIL PROTECTED] wrote: > > Just in case the op doesn't make the connection, he needs to test his > variables for undef before the execute, and if one is undef, then put > null("") in it, something like this: > > if (!defined($a)) {$a = "";} > if (!defined($b)) {$b = "";} >... and so on - you get the idea... > $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) > ) > $sth->execute($a,$b,$c,$d,...$x) or die; Why does he need to do that? I have never had to test my bind values for defined-ness when using placeholders. An undef in Perl becomes a NULL in Oracle, and vice versa. Ronald
Teradata DBD fix for use with TD V2R5.1
Starting with Teradata V2R5.1 by default logons are encrypted. This broke the venerable Teradata DBD V 1.13. You can turn off the requirement for the encryption at the server, but they tend to look at you funny when you tell them you want to muck about on their big bucks server because your Perl scripts stopped working! Is anyone working on a fix? I know they are using Blowfish encryption: http://www.schneier.com/blowfish.html and that for now at least it's just the logon data that is encrypted. With the next major release of TD the plan is to encrypt everything on the network stream. I'd like to see this working again, is anybody working on it? Doug
RE: SQL- Insert problem
You need to ensure your variables have values. In the case where they are undef, assigning them the empty string ("") should be sufficient. If this statement still hangs when doing this, you need to run a 10046 trace for your session to see what is going on (see your DBA for this). - Ron Reidy Senior DBA Array BioPharma, Inc. 303.386.1480 -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:29 AM To: Reidy, Ron; Kong, Alan; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Ok I tried to use method 3 and as I said it hangs. Since it's a dynamic sql some variables are undefined and they do not have any value, now if they don't have any value is it possible that DBI/Oracle will interpret as empty values ? else I have to check the values of each variable and then hardcode to null if there is no value. The print statement shows what is going to be populated. If it is empty I want them to be empty. My print statement and Trace output: Values to insert: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49ea08) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option <- prepare('insert into OPER_QUERY values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' CODE)= DBI::st=HASH(0x49eaa4) at oper_query.pl line 352 DBI::db=HASH(0x49ea08) trace level set to 2 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option <- trace= 1 at oper_query.pl line 353 ^C!! ERROR: 1013 'ORA-01013: user requested cancel of current operation (DBD: oexec error)' <- execute('08/12/04' 'DMOS5' ...)= undef at oper_query.pl line 354 DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexec error) at oper_query.pl line 354. DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexec error) at oper_query.pl line 354. <- DESTROY= undef -> DESTROY for DBD::Oracle::db (DBI::db=HASH(0x49ea08)~INNER) <- DESTROY= undef during global destruction Regards, Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 12:16 PM To: Kong, Alan; Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem He should use bind variables (method 3). - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Kong, Alan [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:13 AM To: Shah, Urmil; Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Try the mothed 2 with non-numeric fields single-quoted. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:07 PM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"
Re: DBD::Sybase 1.04.6 -- Production quality?
> From: Michael Peppler <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri AM 07:50:56 GMT > On Wed, 2004-08-11 at 19:39, amonotod wrote: > > I'm currently using 1.02, but am having problems with it hanging > > against an 11.9.2 server when doing massive non-bulk inserts (50,000+ > space defined, or "trunc. log on checkpoint" turned on? That was it, indeed. Sorry, it's just been several years since I've worked with Sybase full time. Might you know how to control how often the checkpoints happen? The script is successfully populating the database, but it has slowed, rather drastically... > Michael Again, thank you, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
RE: SQL- Insert problem
Just in case the op doesn't make the connection, he needs to test his variables for undef before the execute, and if one is undef, then put null("") in it, something like this: if (!defined($a)) {$a = "";} if (!defined($b)) {$b = "";} ... and so on - you get the idea... $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; HTH. Hardy Merrill >>> "Reidy, Ron" <[EMAIL PROTECTED]> 08/13/04 01:13PM >>> >From your original post ... !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' The error is ---^ This is invalid SQL, as are the others in this statement like this. Because are building dynamic SQL and your variables are 'undef'ined, this is the statement you are sending to the RDBMS engine. You need to ensure your variables have a value and all should be well. However, you should still look at bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:07 AM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831
RE: SQL- Insert problem
Ok I tried to use method 3 and as I said it hangs. Since it's a dynamic sql some variables are undefined and they do not have any value, now if they don't have any value is it possible that DBI/Oracle will interpret as empty values ? else I have to check the values of each variable and then hardcode to null if there is no value. The print statement shows what is going to be populated. If it is empty I want them to be empty. My print statement and Trace output: Values to insert: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49ea08) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option <- prepare('insert into OPER_QUERY values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' CODE)= DBI::st=HASH(0x49eaa4) at oper_query.pl line 352 DBI::db=HASH(0x49ea08) trace level set to 2 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option <- trace= 1 at oper_query.pl line 353 ^C!! ERROR: 1013 'ORA-01013: user requested cancel of current operation (DBD: oexec error)' <- execute('08/12/04' 'DMOS5' ...)= undef at oper_query.pl line 354 DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexec error) at oper_query.pl line 354. DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexec error) at oper_query.pl line 354. <- DESTROY= undef -> DESTROY for DBD::Oracle::db (DBI::db=HASH(0x49ea08)~INNER) <- DESTROY= undef during global destruction Regards, Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 12:16 PM To: Kong, Alan; Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem He should use bind variables (method 3). - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Kong, Alan [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:13 AM To: Shah, Urmil; Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Try the mothed 2 with non-numeric fields single-quoted. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:07 PM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_t
DBD::Multiplex 1.9 problems and patch
Greetings DBI list, I'm not certain this is the right place to send this but the "tkishel AT tdlc.com" address contained within the DBD::Multiplex documentation is bouncing mail. Been running into problems with DBD::Multiplex (1.9) on perl, v5.8.3 built for i686-linux system. Errors were: Modification of non-creatable hash value attempted, subscript "Statement" at /usr/lib/perl5/site_perl/5.8.3/DBD/Multiplex.pm line 415. and Argument "SELECT * FROM foo WHERE bar = 'baz..." isn' t numeric in numeric ne (!=) at /usr/lib/perl5/site_perl/5.8.3/DBD/Multiplex.pm line 535. >From what I gather, DBD drivers are supposed to let the DBI take care of $dbh->{'Statement'} so values within are set "read-only". Didn't bother to really check why DBD::Multiplex is manipulating it, I just inserted a workaround that keeps Perl from barfing. The attached patch fixes both of these minor issues. Question: is there any way to define which servers the dbh handle reads from? I'm using the 'mx_master_id' to specify where writes should be made but I'd like to restrict access to that server to writes--i.e. reads should only be made from one of the replicated DBs and not the master. Is this possible with DBD::Multiplex? If not, should I extend it by inheriting from it or might the functionality be useful enough to incorporated directly into DBD::Multiplex? Thanks for the modules and regards to all contributors, -- Pat Deegan http://www.psychogenic.com/ PGP Key: http://www.keyserver.net 0x03F86A50 --- Multiplex-1.9.pm2004-08-10 18:17:10.0 -0400 +++ Multiplex-1.9.1.pm 2004-08-10 19:05:14.0 -0400 @@ -68,6 +68,7 @@ # TK Note: # do() is a method of a database handle, not a statement handle. if ($method eq 'do' or $method eq 'disconnect') { + delete $parent_handle->{'Statement'}; $parent_handle->{'Statement'} = $_[0]; } @@ -382,6 +383,7 @@ $imp_data_size = 0; use strict; + # The statement handle constructor. # This function calls mx_do_calls and therefore cannot be called using mx_method_all. @@ -412,6 +414,7 @@ } # Don't forget this! + delete $dbh->{Statement}; $dbh->{'Statement'} = $statement; %multiplex_options = ('parent_handle' => $dbh, 'exit_mode' => $exit_mode); @@ -532,7 +535,7 @@ my ($statement) = @_; my ($result); - if (($$statement =~ /^SELECT/i) && ($$statement != /INSERT |UPDATE |DELETE |CREATE |DROP |INTO /i)) { + if (($$statement =~ /^SELECT/i) && ($$statement !~ /INSERT |UPDATE |DELETE |CREATE |DROP |INTO /i)) { $result = 'first_success'; } else {
RE: SQL- Insert problem
He should use bind variables (method 3). - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Kong, Alan [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:13 AM To: Shah, Urmil; Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem Try the mothed 2 with non-numeric fields single-quoted. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:07 PM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. <- DESTROY= undef <- DESTROY= undef during global destruction This column is an integer and its ok if it is null I don't have any constraints defined of not null on this column. * I tried to prepare the statement outside the foreach loop and then pass on the values for those columns in the loop it hangs. Eg: $sth=$dbh->prepare(qq{insert into OPER_QUERY values (?,?,?,?.?) or die; foreach loop{ $sth->execute($mydate,$type, ...
RE: SQL- Insert problem
Try the mothed 2 with non-numeric fields single-quoted. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 1:07 PM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. <- DESTROY= undef <- DESTROY= undef during global destruction This column is an integer and its ok if it is null I don't have any constraints defined of not null on this column. * I tried to prepare the statement outside the foreach loop and then pass on the values for those columns in the loop it hangs. Eg: $sth=$dbh->prepare(qq{insert into OPER_QUERY values (?,?,?,?.?) or die; foreach loop{ $sth->execute($mydate,$type, ..) or die .. } Here it Hangs and does not insert any values. Can any one help on whats going on. I do not want to check each of 15 paramater values to see if they are null or not null before inserting in the db. Regards, Urmil This elect
RE: SQL- Insert problem
>From your original post ... !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' The error is ---^ This is invalid SQL, as are the others in this statement like this. Because are building dynamic SQL and your variables are 'undef'ined, this is the statement you are sending to the RDBMS engine. You need to ensure your variables have a value and all should be well. However, you should still look at bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:07 AM To: Reidy, Ron; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. <- DE
RE: SQL- Insert problem
I tried to use different methods to insert but all fails. 1) $sth=$dbh->prepare(insert into OPER_QUERY values ($a,$b,$c,$d) ) $sth->execute() or die; 2) $sth=$dbh->prepare(insert into OPER_QUERY (col1, col2, col3..co15) values($a,$b,$c,$d) ) $sth->execute() or die; 3) $sth=$dbh->prepare(insert into OPER_QUERY values (?,?,?,?,?) ) $sth->execute($a,$b,$c,$d,...$x) or die; For case 1 and 2 it gives error saying the value is empty. In case 3 it just hangs and does not populate anything and I have to kill the script. If there is any other way to insert please let me know. Urmil -Original Message- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 11:57 AM To: Shah, Urmil; [EMAIL PROTECTED] Subject: RE: SQL- Insert problem You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. <- DESTROY= undef <- DESTROY= undef during global destruction This column is an integer and its ok if it is null I don't have any constraints defined of not null on this column. * I tried to prepare the statement outside the foreach loop and then pass on the values for those columns in the loop it hangs. Eg: $sth=$dbh->prepare(qq{insert into OPER_QUERY values (?,?,?,?.?) or die; foreach loop{ $sth->execute($mydate,$type, ..) or die .. } Here it Hangs and does not insert any values. Can any one help on whats going on. I do not want to check each of 15 paramater values to see if they are null or not null before inserting in the db. Regards, Urmil This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the inten
RE: SQL- Insert problem
You have a NULL (not the word NULL) in your statement. FYI - You should look into using bind variables. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Shah, Urmil [mailto:[EMAIL PROTECTED] Sent: Friday, August 13, 2004 10:43 AM To: [EMAIL PROTECTED] Subject: SQL- Insert problem Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. <- DESTROY= undef <- DESTROY= undef during global destruction This column is an integer and its ok if it is null I don't have any constraints defined of not null on this column. * I tried to prepare the statement outside the foreach loop and then pass on the values for those columns in the loop it hangs. Eg: $sth=$dbh->prepare(qq{insert into OPER_QUERY values (?,?,?,?.?) or die; foreach loop{ $sth->execute($mydate,$type, ..) or die .. } Here it Hangs and does not insert any values. Can any one help on whats going on. I do not want to check each of 15 paramater values to see if they are null or not null before inserting in the db. Regards, Urmil This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
SQL- Insert problem
Need help in trying to insert an sql statement. 1) I have 15 columns in oracle database defined. 2) Through Perl DBI I am trying to loop and populate these 15 columns for 'n' of rows. 3) Some of the column values that I am trying to insert is null/empty and it is ok if they are empty <-- It gives me error when it find null value. Code: foreach my $type(sort keys %H_CNT_BY_PGM){ foreach my $pgm(sort keys %{$H_CNT_BY_PGM{$type}}){ $sth1 = $dbh->prepare(qq{insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values ($mydate,$site,$type,$pgm,$Tot,$Tot_yes,$Tot_rmenu,$dev_type_err,$test_t ype_err,$temp_type_err,$lot_type_err,$rmenu_dev_type_err,$rmenu_test_typ e_err,$rmenu_temp_type_err,$rmenu_lot_type_err)}) or die"Cannot prepare sql:$DBI::errstr\n"; $sth1->execute() or die"Cannot prepare sql:$DBI::errstr\n"; }#foreach }#foreach dbi Trace(1) output : start inserting: 08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32, DBI::db=HASH(0x49fcbc) trace level set to 1 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option !! ERROR: 936 'ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)')' <- prepare('insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,,2,10,,,2,32,)' CODE)= undef at oper_query.pl line 351 DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. DBD::Oracle::db prepare failed: ORA-00936: missing expression (DBD: error possibly near <*> indicator at char 252 in 'insert into OPER_QUERY (end_date,site,tester_type,program,total,oper_yes,rmenu_yes,opr_dev_type ,opr_test_type,opr_temp_type,opr_lot_type,rmenu_dev_type,rmenu_test_type ,rmenu_temp_type,rmenu_lot_type) values(08/12/04,DMOS5,POLARIS100,P1831C02,91,22,49,<*>,2,10,,,2,32,)') at oper_query.pl line 351. <- DESTROY= undef <- DESTROY= undef during global destruction This column is an integer and its ok if it is null I don't have any constraints defined of not null on this column. * I tried to prepare the statement outside the foreach loop and then pass on the values for those columns in the loop it hangs. Eg: $sth=$dbh->prepare(qq{insert into OPER_QUERY values (?,?,?,?.?) or die; foreach loop{ $sth->execute($mydate,$type, ..) or die .. } Here it Hangs and does not insert any values. Can any one help on whats going on. I do not want to check each of 15 paramater values to see if they are null or not null before inserting in the db. Regards, Urmil
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
> From: amonotod <[EMAIL PROTECTED]> > Date: 2004/08/13 Fri PM 04:01:54 GMT > > Results of a failed build are below. Or perhaps, not. Apparently, failed tests are not indicative of a failed build. 'nmake install' went just fine, and my DBI scripts work just fine against Oracle 8i and Oracle 9i servers... :-) amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
> From: Tim Bunce <[EMAIL PROTECTED]> > Date: 2004/08/07 Sat PM 10:32:45 GMT > > A mature, and hopefully final, release candidate of DBD::Oracle 1.16 > Please help by taking a moment to at least check it builds and tests okay > in your environment. > Thank you. > Tim. Results of a failed build are below. Environment is Win2K SP4, AS Perl 5.8.3, MS VC 6.0 SP5. I would be happy to try again, if I am provided with possible fixes... Thank you, amonotod C:\Perl\installs\DBD_Oracle\DBD-Oracle-1.16>perl Makefile.pl Using DBI 1.43 (for perl 5.008003 on MSWin32-x86-multi-thread) installed in C:/Perl/site/lib/auto/DBI Configuring DBD::Oracle ... >>> Remember to actually *READ* the README file! Especially if you have any problems. Using Oracle in d:/ora9i Oracle version 9.2.0.1 (9.2) Found oci directory Using OCI directory 'oci' Found oci/lib/MSVC/oci.lib library Found oci/lib/MSVC/ociw32.lib library Found oci/lib/MSVC/oramts.lib library Found oci/lib/MSVC/oraocci9.lib library Using oci/lib/MSVC/OCI.lib Checking for functioning wait.ph System: perl5.008003 Compiler: cl -MD -Zi -DNDEBUG -O1 -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYP T -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX Linker: not found Sysliblist: Checking if your kit is complete... Looks good LD_RUN_PATH=d:/ora9i/lib:d:/ora9i/rdbms/lib Using DBD::Oracle 1.16. Using DBD::Oracle 1.16. Using DBI 1.43 (for perl 5.008003 on MSWin32-x86-multi-thread) installed in C:/Perl/site/lib/auto/DBI Writing Makefile for DBD::Oracle *** If you have problems... read all the log printed above, and the README and README.help files. (Of course, you have read README by now anyway, haven't you?) C:\Perl\installs\DBD_Oracle\DBD-Oracle-1.16>nmake Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. cp Oracle.pm blib\lib\DBD\Oracle.pm cp oraperl.ph blib\lib/oraperl.ph cp dbdimp.h blib\arch\auto\DBD\Oracle/dbdimp.h cp ocitrace.h blib\arch\auto\DBD\Oracle/ocitrace.h cp Oraperl.pm blib\lib/Oraperl.pm cp Oracle.h blib\arch\auto\DBD\Oracle/Oracle.h cp lib/DBD/Oracle/GetInfo.pm blib\lib\DBD\Oracle\GetInfo.pm cp mk.pm blib\arch\auto\DBD\Oracle/mk.pm C:\Perl\bin\perl.exe -p -e "s/~DRIVER~/Oracle/g" C:/Perl/site/lib/auto/DBI/Driver.xst > Oracle.xsi C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils/xsubpp -typemap C:\Perl\lib\ExtUtils\typemap -typemap typemap Oracle .xs > Oracle.xsc && C:\Perl\bin\perl.exe -MExtUtils::Command -e mv Oracle.xsc Oracle.c cl -c -Id:/ora9i/oci/include -Id:/ora9i/rdbms/demo -IC:/Perl/site/lib/auto/DBI -nologo -Gf -W3 -MD -Zi -DNDEBU G -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_ PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1-DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-IC:\Perl\lib\CORE" -D UTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"9.2\" Oracle.c Oracle.c Oracle.xs(188) : warning C4101: 'startp' : unreferenced local variable cl -c -Id:/ora9i/oci/include -Id:/ora9i/rdbms/demo -IC:/Perl/site/lib/auto/DBI -nologo -Gf -W3 -MD -Zi -DNDEBU G -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_ PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1-DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-IC:\Perl\lib\CORE" -D UTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"9.2\" dbdimp.c dbdimp.c dbdimp.c(1127) : warning C4018: '<' : signed/unsigned mismatch dbdimp.c(1127) : warning C4018: '<' : signed/unsigned mismatch dbdimp.c(1657) : warning C4018: '!=' : signed/unsigned mismatch cl -c -Id:/ora9i/oci/include -Id:/ora9i/rdbms/demo -IC:/Perl/site/lib/auto/DBI -nologo -Gf -W3 -MD -Zi -DNDEBU G -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_ PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1-DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" "-IC:\Perl\lib\CORE" -D UTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"9.2\" oci8.c oci8.c Running Mkbootstrap for DBD::Oracle () C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 Oracle.bs C:\Perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('NAME'=>\"DBD::Oracle\", 'DLBASE' => 'Oracle', 'DL_F UNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\DBD\Oracle\Oracle.dll -dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl \lib\CORE" -machine:x86 Oracle.obj dbdimp.obj oci8.obj C:\Perl\lib\CORE\perl58.lib d:\ora9i\oci\LIB\MSVC\OCI.lib C: \PROGRA~1\MICROS~3\VC98\lib\oldnames.lib C:\PROGRA~1\MICROS~3\VC98\lib\kernel32.lib C:\PROGRA~1\MICROS~3\VC98\lib\user32 .lib C:\PROGRA~1\MICROS~3\VC98\lib\gdi32.lib C:\PROGRA~1\MICROS~3\VC98\lib\winspool.lib C:\PROGRA~1\MICROS~3\VC98\l
Re: Oracle 9.2 upgrade breaks Perl DBI
Did you recompile DBD::Oracle since Oracle 9.2 was installed? >>> "Richard Freedman" <[EMAIL PROTECTED]> 08/10/04 07:52PM >>> Our DBA has recently upgraded Oracle from 8.1.7 to 9.2. I tried changing my ORACLE_HOME enviornment and it broke my DBI/DBD::Oracle. If I run $ENV{ORACLE_HOME} = "/opt/oracle/products/8.1.7"; $db = DBI->connect ("dbi:Oracle:xxx", "uname", "pword", {AutoCommit=>0}); all is well If I run $ENV{ORACLE_HOME} = "/opt/oracle/products/9.2"; $db = DBI->connect ("dbi:Oracle:xxx", "uname", "pword", {AutoCommit=>0}) or croak "Database Error: $DBI::errstr\n"; I get DBI->connect(xxx) failed: ERROR OCIEnvInit I am running Sun Solaris, Perl 5.6.1, DBI 1.20, DBD::Oracle 1.12 Please help. Richard Freedman Bioinformatics Scientist Cytokinetics (650)624-3027
RE: Oracle 9.2 upgrade breaks Perl DBI
Reinstall DBD::Oracle using the 9i environment. - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Richard Freedman [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 5:53 PM To: [EMAIL PROTECTED] Subject: Oracle 9.2 upgrade breaks Perl DBI Our DBA has recently upgraded Oracle from 8.1.7 to 9.2. I tried changing my ORACLE_HOME enviornment and it broke my DBI/DBD::Oracle. If I run $ENV{ORACLE_HOME} = "/opt/oracle/products/8.1.7"; $db = DBI->connect ("dbi:Oracle:xxx", "uname", "pword", {AutoCommit=>0}); all is well If I run $ENV{ORACLE_HOME} = "/opt/oracle/products/9.2"; $db = DBI->connect ("dbi:Oracle:xxx", "uname", "pword", {AutoCommit=>0}) or croak "Database Error: $DBI::errstr\n"; I get DBI->connect(xxx) failed: ERROR OCIEnvInit I am running Sun Solaris, Perl 5.6.1, DBI 1.20, DBD::Oracle 1.12 Please help. Richard Freedman Bioinformatics Scientist Cytokinetics (650)624-3027 This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
Oracle 9.2 upgrade breaks Perl DBI
Our DBA has recently upgraded Oracle from 8.1.7 to 9.2. I tried changing my ORACLE_HOME enviornment and it broke my DBI/DBD::Oracle. If I run $ENV{ORACLE_HOME} = "/opt/oracle/products/8.1.7"; $db = DBI->connect ("dbi:Oracle:xxx", "uname", "pword", {AutoCommit=>0}); all is well If I run $ENV{ORACLE_HOME} = "/opt/oracle/products/9.2"; $db = DBI->connect ("dbi:Oracle:xxx", "uname", "pword", {AutoCommit=>0}) or croak "Database Error: $DBI::errstr\n"; I get DBI->connect(xxx) failed: ERROR OCIEnvInit I am running Sun Solaris, Perl 5.6.1, DBI 1.20, DBD::Oracle 1.12 Please help. Richard Freedman Bioinformatics Scientist Cytokinetics (650)624-3027
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
Tim Bunce wrote: >mAsterdam wrote: >>Tim Bunce wrote: >>>mAsterdam wrote: Oracle 8.1.7 ... >> >>>Can you send me the output (stdout+stderr) from >>>"perl -Mblib t/.t" where is each of the tests >>> that generated that error? ... >> >>@foo = ('23wide_db', '23wide_db_al32utf8'); > >>set $ENV{NLS_LANG}=AMERICAN_AMERICA.AL32UTF8 >>DBI connect(...) failed: ORA-12705: invalid or unknown NLS >> parameter value specified (DBD ERROR: OCISessionBegin) at >> t/nchar_test_lib.pl line 143 >> 1..0 # Skip Not connected to oracle > >Ah. Oracle 8 client doesn't understand "AL32UTF8". > >>$ perl -Mblib t/23wide_db_al32utf8.t >>... > >Same. > >Both those tests should be automatically skipped for Oracle 8. Is there a way to determine which values for NLS_LANG the client *can* understand - to be able to automatically skip everything else? OCINlsGetInfo ??? >You can ignore the failures. Ok. Thank you.
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
test DBD::Oracle 1.16rc6 on HP-UX 11.00 and Oracle 8.1.7.0 (server and client the same revision) using perl 5.6.1 see attachments. -- Silvio Wanka| e-mail: [EMAIL PROTECTED] + umask 022 + export ORACLE_HOME=/opt/Oracle + export ORACLE_USERID=guest/guest + export TWO_TASK=dbtest817 + make test cp Oracle.pm blib/lib/DBD/Oracle.pm cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h cp oraperl.ph blib/lib/oraperl.ph cp Oraperl.pm blib/lib/Oraperl.pm /bin/sh -c true /bin/sh -c true /opt/perl5/v6s1/bin/hppa1.1-hp-hpux11.00/perl -p -e "s/~DRIVER~/Oracle/g" /opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux11.00/auto/DBI/Driver.xst > Oracle.xsi /opt/perl5/v6s1/bin/hppa1.1-hp-hpux11.00/perl -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00 -I/opt/perl5/v6s1/lib/share /opt/perl5/v6s1/lib/share/ExtUtils/xsubpp -typemap /opt/perl5/v6s1/lib/share/ExtUtils/typemap -typemap typemap Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c cc -c -I/opt/Oracle/rdbms/public -I/opt/Oracle/rdbms/demo -I/opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux11.00/auto/DBI -Ae +DA1.1 +DS2.0 -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +ESlit +Oentrysched +Ofastaccess +Olibcalls +Onolimit-DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" +z -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00/CORE -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8.1\" Oracle.c cc -c -I/opt/Oracle/rdbms/public -I/opt/Oracle/rdbms/demo -I/opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux11.00/auto/DBI -Ae +DA1.1 +DS2.0 -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +ESlit +Oentrysched +Ofastaccess +Olibcalls +Onolimit-DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" +z -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00/CORE -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8.1\" dbdimp.c cc -c -I/opt/Oracle/rdbms/public -I/opt/Oracle/rdbms/demo -I/opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux11.00/auto/DBI -Ae +DA1.1 +DS2.0 -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +ESlit +Oentrysched +Ofastaccess +Olibcalls +Onolimit-DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" +z -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00/CORE -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8.1\" oci8.c Running Mkbootstrap for DBD::Oracle () chmod 644 Oracle.bs rm -f blib/arch/auto/DBD/Oracle/Oracle.sl ld +b "/opt/Oracle/lib" -b -B symbolic Oracle.o dbdimp.o oci8.o -o blib/arch/auto/DBD/Oracle/Oracle.sl -L/opt/Oracle/lib -lclntsh -lrt -lpthread chmod 755 blib/arch/auto/DBD/Oracle/Oracle.sl cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs /opt/perl5/v6s1/bin/hppa1.1-hp-hpux11.00/perl -Iblib/arch -Iblib/lib -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00 -I/opt/perl5/v6s1/lib/share ora_explain.PL ora_explain Extracted ora_explain from ora_explain.PL with variable substitutions. cp ora_explain blib/script/ora_explain /opt/perl5/v6s1/bin/hppa1.1-hp-hpux11.00/perl -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00 -I/opt/perl5/v6s1/lib/share -MExtUtils::MakeMaker -e "MY->fixin(shift)" blib/script/ora_explain PERL_DL_NONLAZY=1 /opt/perl5/v6s1/bin/hppa1.1-hp-hpux11.00/perl -Iblib/arch -Iblib/lib -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux11.00 -I/opt/perl5/v6s1/lib/share -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t t/01baseok t/10general.ok t/15nls.ok t/20select..ok t/21nchar...ok t/22nchar_al32utf8..skipped: Database NCHAR character set is not Unicode t/22nchar_utf8..skipped: Database NCHAR character set is not Unicode t/23wide_db.DBI connect('','guest/guest',...) failed: (no error string) at t/nchar_test_lib.pl line 143 skipped: Not connected to oracle t/23wide_db_8bitskipped: Database character set is not Unicode t/23wide_db_al32utf8.DBI connect('','guest/guest',...) failed: (no error string) at t/nchar_test_lib.pl line 143 skipped: Not connected to oracle t/24implicit_utf8...skipped: Database NCHAR character set is not Unicode t/25plsql...ok t/30longok, 127/460 skipped: various reasons t/31lob.FAILED tests 1-2 Failed 2/2 tests, 0.00% okay t/40ph_type.ok t/50cursor..ok t/60reauth..skipped test on this platform t/70metaok Failed Test Status Wstat Total Fail Failed List of Failed - t/31lob.t 22 100.00% 1-2 7 tests and 127 subtests skipped. Failed 1/18 test scripts, 94.44% okay. 2/704 subtests failed, 99.72% okay. *** Error exit code 25 + umask 022 + export ORACLE_HOME=/opt/Oracle + export ORACLE_USERID=guest/guest + export TWO_TASK=dbtest817 + make TEST_FILE=t/31lob.t tes
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
test DBD::Oracle 1.16rc6 on HP-UX 10.20 and Oracle 8.0.6.0 (server and client the same revision) + umask 022 + export ORACLE_HOME=/opt/oracle/v806 + export ORACLE_USERID=guest/guest + export TNS_ADMIN=/home/ddts/local + export TWO_TASK=dbtset806 + make test cp Oracle.pm blib/lib/DBD/Oracle.pm cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h cp oraperl.ph blib/lib/oraperl.ph cp Oraperl.pm blib/lib/Oraperl.pm /bin/sh -c true /bin/sh -c true /opt/perl5/v6s1/bin/hppa1.1-hp-hpux10.20/perl -p -e "s/~DRIVER~/Oracle/g" /opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux10.20/auto/DBI/Driver.xst > Oracle.xsi /opt/perl5/v6s1/bin/hppa1.1-hp-hpux10.20/perl -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20 -I/opt/perl5/v6s1/lib/share /opt/perl5/v6s1/lib/share/ExtUtils/xsubpp -typemap /opt/perl5/v6s1/lib/share/ExtUtils/typemap -typemap typemap Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c cc -c -I/opt/oracle/v806/rdbms/demo -I/opt/oracle/v806/network/public -I/opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux10.20/auto/DBI -Ae +DA1.1 +DS2.0 -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +ESlit +Oentrysched +Ofastaccess +Olibcalls +Onolimit -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" +z -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20/CORE -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8.0\" Oracle.c cc -c -I/opt/oracle/v806/rdbms/demo -I/opt/oracle/v806/network/public -I/opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux10.20/auto/DBI -Ae +DA1.1 +DS2.0 -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +ESlit +Oentrysched +Ofastaccess +Olibcalls +Onolimit -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" +z -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20/CORE -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8.0\" dbdimp.c cc -c -I/opt/oracle/v806/rdbms/demo -I/opt/oracle/v806/network/public -I/opt/perl5/site/lib/5.6.1/hppa1.1-hp-hpux10.20/auto/DBI -Ae +DA1.1 +DS2.0 -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +ESlit +Oentrysched +Ofastaccess +Olibcalls +Onolimit -DVERSION=\"1.16\" -DXS_VERSION=\"1.16\" +z -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20/CORE -DUTF8_SUPPORT -DORA_OCI_VERSION=\"8.0\" oci8.c Running Mkbootstrap for DBD::Oracle () chmod 644 Oracle.bs rm -f blib/arch/auto/DBD/Oracle/Oracle.sl ld +b "/opt/oracle/v806/lib" -b -B symbolic Oracle.o dbdimp.o oci8.o -o blib/arch/auto/DBD/Oracle/Oracle.sl -L/opt/oracle/v806/lib -lextp -lclntsh -lm -lc chmod 755 blib/arch/auto/DBD/Oracle/Oracle.sl cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs /opt/perl5/v6s1/bin/hppa1.1-hp-hpux10.20/perl -Iblib/arch -Iblib/lib -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20 -I/opt/perl5/v6s1/lib/share ora_explain.PL ora_explain Extracted ora_explain from ora_explain.PL with variable substitutions. cp ora_explain blib/script/ora_explain /opt/perl5/v6s1/bin/hppa1.1-hp-hpux10.20/perl -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20 -I/opt/perl5/v6s1/lib/share -MExtUtils::MakeMaker -e "MY->fixin(shift)" blib/script/ora_explain PERL_DL_NONLAZY=1 /opt/perl5/v6s1/bin/hppa1.1-hp-hpux10.20/perl -Iblib/arch -Iblib/lib -I/opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20 -I/opt/perl5/v6s1/lib/share -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t t/01base/usr/lib/dld.sl: Unresolved symbol: OCILobIsTemporary (code) from blib/arch/auto/DBD/Oracle/Oracle.sl /usr/lib/dld.sl: Unresolved symbol: OCILobFreeTemporary (code) from blib/arch/auto/DBD/Oracle/Oracle.sl Failed to load Oracle extension and/or shared libraries: install_driver(Oracle) failed: Can't load 'blib/arch/auto/DBD/Oracle/Oracle.sl' for module DBD::Oracle: Unresolved external at /opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20/DynaLoader.pm line 206. at (eval 1) line 3 Compilation failed in require at (eval 1) line 3. Perhaps a required shared library or dll isn't installed where expected at t/01base.t line 19 The remaining tests will probably also fail with the same error. *** Please read the README and README.help files for help. *** FAILED tests 4-5 Failed 2/5 tests, 60.00% okay t/10general./usr/lib/dld.sl: Unresolved symbol: OCILobIsTemporary (code) from blib/arch/auto/DBD/Oracle/Oracle.sl /usr/lib/dld.sl: Unresolved symbol: OCILobFreeTemporary (code) from blib/arch/auto/DBD/Oracle/Oracle.sl install_driver(Oracle) failed: Can't load 'blib/arch/auto/DBD/Oracle/Oracle.sl' for module DBD::Oracle: Unresolved external at /opt/perl5/v6s1/lib/hppa1.1-hp-hpux10.20/DynaLoader.pm line 206. at (eval 1) line 3 Compilation failed in require at (eval 1) line 3. Perhaps a required shared library or dll isn't installed where expected at blib/lib/Oraperl.pm line 58 Compilation failed in require at t/10general.t line 6. BEGIN failed--compilation aborted at t/10general.t line 6. dubious Test returned status 255 (wstat 65280, 0xff00) -- Silvio Wanka
Re: Derefencing DBI SQL statements
Use "trace". Here's the whole section from "perldoc DBI" about using trace: "trace" DBI->trace($trace_level) DBI->trace($trace_level, $trace_filename) DBI trace information can be enabled for all handles using the "trace" DBI class method. To enable trace information for a specific handle, use the similar "$h->trace" method described elsewhere. Trace levels are as follows: 0 - Trace disabled. 1 - Trace DBI method calls returning with results or errors. 2 - Trace method entry with parameters and returning with results. 3 - As above, adding some high-level information from the driver and some internal information from the DBI. 4 - As above, adding more detailed information from the driver. 5 and above - As above but with more and more obscure information. Trace level 1 is best for a simple overview of what's happening. Trace level 2 is a good choice for general purpose tracing. Levels 3 and above (up to 9) are best reserved for investigating a specific problem, when you need to see "inside" the driver and DBI. The trace output is detailed and typically very useful. Much of the trace output is formatted using the "neat" function, so strings in the trace output may be edited and truncated. Initially trace output is written to "STDERR". If $trace_filename is specified and can be opened in append mode then all trace output (including that from other handles) is redirected to that file. A warning is generated is the file can't be opened. Further calls to "trace" without a $trace_filename do not alter where the trace output is sent. If $trace_filename is undefined, then trace output is sent to "STDERR" and the previous trace file is closed. The "trace" method returns the *previous* tracelevel. See also the "$h->trace" and "$h->trace_msg" methods and the "DEBUGGING" section for information about the "DBI_TRACE" environment variable. --- HTH. Hardy Merrill >>> <[EMAIL PROTECTED]> 08/11/04 02:56AM >>> Is there a way to dereference the SQL statement that is send to the DBD? I am loading a master table with 19+ fields and there seem to be a problem at the end of the SQL statement. I want to see what is the DBI/DBD sending to the Database. example: $q3 = $dbh->prepare("INSERT INTO MasterRealtor (@qtColumns, date) VALUES (@Insert,\"$date\")"); $q3->execute or die "ERROR: $q3->errstr \n"; Want to see what the value/string of $q3 is? Tnank you all -Max
Re: fetch entire table
Not sure if this is what you're looking for, but do perldoc DBI at a command prompt and search for "selectall_arrayref", "selectall_hashref", and "fetchall_arrayref". Hardy Merrill >>> Xinyu Wen <[EMAIL PROTECTED]> 08/11/04 12:34PM >>> Hi, I would like to know if there is a better way to fetch an entire table to a file (the file has to be tab delimited) instead of using fetchrow_array function? Fetchrow_array is working fine but slow to work with a big table. Thanks, Adam.
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
On Sat, Aug 07, 2004 at 11:32:45PM +0100, Tim Bunce wrote: > A mature, and hopefully final, release candidate of DBD::Oracle 1.16 > is available for testing at: > > http://homepage.eircom.net/~timbunce/DBD-Oracle-1.16-rc6-20040807.tar.gz > > Please help by taking a moment to at least check it builds and tests okay > in your environment. Built and tested against DBI-1.43 on the following platforms (see below for make test output): * sparc-solaris-5.8_perl5.8.3_orac9.2.0.4 [1] * ia64-linux-2.4.25_perl5.8.3_orac9.2.0.2 [2] * ia32-linux-2.4.24_perl5.8.3_orac9.2.0.1 [3] The server for all tests was ``Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production''. Configured and built fine. All tests passed. See for more details: http://genome.wustl.edu/~ddooling/dbd-oracle/ I am currently trying to build against 8.1 Oracle client libraries on sparc-solaris and ia32-linux and am having some difficulties (I have built previous versions of perl and DBD-Oracle against them). I am trying to figure out if the problem is mine or DBD-Oracle's. Will post more when I get it figured out (or give up). dd -- David Dooling [1] sparc-solaris-5.8_perl5.8.3_orac9.2.0.4 t/01baseok t/10general.ok t/15nls.ok t/20select..ok t/21nchar...ok t/22nchar_al32utf8..ok t/22nchar_utf8..ok t/23wide_db.skipped all skipped: Database character set is not Unicode t/23wide_db_8bitskipped all skipped: Database character set is not Unicode t/23wide_db_al32utf8skipped all skipped: Database character set is not Unicode t/24implicit_utf8...ok t/25plsql...ok t/30longok 118/460 skipped: various reasons t/31lob.ok t/40ph_type. Placeholder behaviour for ora_type=1 (the default) varies with Oracle version. Oracle 7 didn't strip trailing spaces, Oracle 8 did, until 9.2.x Your system doesn't. If that seems odd, let us know. ok t/50cursor..ok t/60reauth..skipped all skipped: no reason given t/70metaok All tests successful, 4 tests and 118 subtests skipped. Files=18, Tests=852, 39 wallclock secs (11.61 cusr + 2.99 csys = 14.60 CPU) [2] ia64-linux-2.4.25_perl5.8.3_orac9.2.0.2 t/01baseok t/10general.ok t/15nls.ok t/20select..ok t/21nchar...ok t/22nchar_al32utf8..ok t/22nchar_utf8..ok t/23wide_db.skipped all skipped: Database character set is not Unicode t/23wide_db_8bitskipped all skipped: Database character set is not Unicode t/23wide_db_al32utf8skipped all skipped: Database character set is not Unicode t/24implicit_utf8...ok t/25plsql...ok t/30longok 118/460 skipped: various reasons t/31lob.ok t/40ph_type. Placeholder behaviour for ora_type=1 (the default) varies with Oracle version. Oracle 7 didn't strip trailing spaces, Oracle 8 did, until 9.2.x Your system doesn't. If that seems odd, let us know. ok t/50cursor..ok t/60reauth..skipped all skipped: no reason given t/70metaok All tests successful, 4 tests and 118 subtests skipped. Files=18, Tests=852, 27 wallclock secs ( 2.21 cusr + 0.28 csys = 2.49 CPU) [3] ia32-linux-2.4.24_perl5.8.3_orac9.2.0.1 t/01baseok t/10general.ok t/15nls.ok t/20select..Unexpectedly had to drop old test table 'dbd_ora__drop_me' ok t/21nchar...ok t/22nchar_al32utf8..ok t/22nchar_utf8..ok t/23wide_db.skipped all skipped: Database character set is not Unicode t/23wide_db_8bitskipped all skipped: Database character set is not Unicode t/23wide_db_al32utf8skipped all skipped: Database character set is not Unicode t/24implicit_utf8...ok t/25plsql...ok t/30longok 118/460 skipped: various reasons t/31lob.ok t/40ph_type.ok t/50cursor..ok t/60reauth..skipped all skipped: no reason given t/70metaok All tests successful, 4 tests and 118 subtests skipped. Files=18, Tests=852, 27 wallclock secs ( 2.63 cusr + 0.54 csys = 3.17 CPU)
DBD Oracle on 64bit
Hey Anyone had a problem installing the DBD::Oracle module on a 64bit version of oracle 9? I keep getting the following errors Thanks joe
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
On Mon, Aug 09, 2004 at 07:02:20PM +0200, mAsterdam wrote: > Tim Bunce wrote: > > >mAsterdam wrote: > >>Oracle 8.1.7 ... > > >Can you send me the output (stdout+stderr) from "perl -Mblib t/.t" > >where is each of the tests that generated that error? > >(Then the same again but with DBI_TRACE=9 would also be handy.) > > @foo = ('23wide_db', '23wide_db_al32utf8'); > set $ENV{NLS_LANG}=AMERICAN_AMERICA.AL32UTF8 > DBI connect('','scott/tiger',...) failed: ORA-12705: invalid or unknown NLS > parameter value specified (DBD ERROR: OCISessionBegin) at t/nchar_test_lib.pl line > 143 > 1..0 # Skip Not connected to oracle Ah. Oracle 8 client doesn't understand "AL32UTF8". > $ perl -Mblib t/23wide_db_al32utf8.t > set $ENV{NLS_LANG}=AMERICAN_AMERICA.AL32UTF8 > DBI connect('','scott/tiger',...) failed: ORA-12705: invalid or unknown NLS > parameter value specified (DBD ERROR: OCISessionBegin) at t/nchar_test_lib.pl line > 143 Same. Both those tests should be automatically skipped for Oracle 8. You can ignore the failures. Tim.
Re: DBD::Sybase 1.04.6 -- Production quality?
On Wed, 2004-08-11 at 19:39, amonotod wrote: > Hey all, > For those of you who have tried the new DBD::Sybase, announced on 4 > Aug, would you consider it production quality? Yes, apart from the BLK stuff. > > I'm currently using 1.02, but am having problems with it hanging > against an 11.9.2 server when doing massive non-bulk inserts (50,000+ > rows). I figured before I do anything else, I'd upgrade to the latest > stable version, which I suppose is 1.03, but if 1.04 is of good > quality, I'll upgrade all the way to that... That's most likely NOT an issue with DBD::Sybase. Do you have enough log space defined, or "trunc. log on checkpoint" turned on? Michael -- Michael Peppler Data Migrations, Inc. [EMAIL PROTECTED] http://www.peppler.org/ Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or long term contract positions - http://www.peppler.org/resume.html
Re: fetch entire table
On Wed, 11 Aug 2004 11:34:00 -0500 Xinyu Wen <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to know if there is a better way to fetch an entire table > to a file (the file has to be tab delimited) instead of using > fetchrow_array function? Fetchrow_array is working fine but slow to > work with a big table. Hi Try to read this and I think you will find everything you want ! http://search.cpan.org/src/TIMB/DBI_AdvancedTalk_2004/index.htm for example use fetchrow_array_ref instead Fred > > Thanks, > > Adam. > -- Frédéric Sapet *** Génoplante-Info 523 place des Terrasses 91000 Evry 01 60 87 37 59 [EMAIL PROTECTED] ***
Re: no DBD:MSSQL?
Hardy Merrill wrote: - What is DBD::ODBC? Why can't I connect? Do I need an ODBC driver? What is the ODBC driver manager? Where do I get an ODBC driver manager for Unix/Linux? How do I access a MS SQL Server database from Linux? For Unix -> Windows DB see Tom Lowery's write-up. http://tlowery.hypermart.net/perl_dbi_dbd_faq.html#HowDoIAccessMSWin dowsDB I took that page (actually the whole site) down a while ago. The document was very dated. However, I just completed the exercise evaluating solutions for connecting to a MS SQL Server database from Linux. When I've extra time and find the DBI FAQ again, I'll write you the methods below. I tested 4 methods, 3 based using unixODBC with FreeTDS ODBC driver, Easysoft Bridge, and DataDirect ODBC. The 4th was using DBD::Sybase. I had all 4 working within a 5 hours. The FreeTDS ODBC driver is buggy (haven't had time to write up test cases to submit). Perl seg faults when attempting to insert a string into integer column, the messages aren't very descriptive (but that could be Sql Server) however it does work. DBD::Sybase compiled against FreeTDS worked, however the driver doesn't support place holders ... major down fall. The Easysoft bridge was the simplest to install. IIRC, Easysoft contributes to the development of unixODBC (help those who help us). The cost of packages required is very reasonable. The downside was having to install software on both Unix/Linux and MS side and speed. The DataDirect was a tricker to install. The install script required csh, which I had to install, then the script failed. I ended up finding the tar ball and doing the install manually. Needed to edit some of the configuration files afterwards and (since I install datadirect drivers in a separate directory) add LD_LIBRARY_PATH. The driver is fast and solid, however very very pricey. With any of the drivers you need to add entries to odbcinst.ini and odbc.ini (either global or ~/.odbc.ini) Here are the steps to to install unixODBC with FreeTDS: Installing unixODBC with FreeTDS Fri Jul 23 13:12:48 EDT 2004 Download source code from unixODBC: http://www.unixodbc.org/download.html FreeTDS: ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz Installing unixODBC tar zxvf unixODBC-2.2.9.tar.gz creates directory unixODBC-2.2.9 cd unixODBC-2.2.9 For my local install, I used the following. configure --prefix=/usr/local/odbc --disable-gui make make check make install Create /etc/profile.d/odbc.sh to set the environmental variables. if [ -s "$LD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/odbc/lib else LD_LIBRARY_PATH=/usr/local/odbc/lib fi ODBCHOME=/usr/local/odbc ODBCINI=/usr/local/odbc/etc export LB_LIBRARY_PATH ODBCHOME ODBCINI I created a template for PostgreSQL. create pg_template1.txt [PostgreSQL] Description = PostgreSQL driver for Linux & Win32 Driver = /usr/local/odbc/lib/libodbcpsql.so Setup = /usr/local/odbc/lib/libodbcpsqlS.so FileUsage = 1 [PostgreSQLThreads] Description = PostgreSQL driver for Linux & Win32 Driver = /usr/local/lib/libodbcpsql.so Setup = /usr/local/lib/libodbcpsqlS.so Threading = 2 Install the template into odbcinst.ini using the following sudo /usr/local/odbc/bin/odbcinst -i -d -f pg_template1.txt I created a template for PostgreSQL for odbc.ini [PostgreSQL] Description = Test to Postgres Driver = PostgreSQL Trace = Yes TraceFile = sql.log Database= database_name Servername = machine UserName= Password= Port= 5432 Protocol= 6.4 ReadOnly= No RowVersioning = No ShowSystemTables= No ShowOidColumn = No FakeOidIndex= No ConnSettings= sudo /usr/local/odbc/bin/odbcinst -i -s -f pg_template_ini1.txt Unpack the FreeTDS package. tar zxvf freetds-stable.tgz configure --help > myconfig.sh Creating the file myconfig.sh configure --prefix=/usr/local/odbc --with-unixodbc=/usr/local/odbc make make check sudo make install Create a template file for FreeTDS driver in odbcinst.ini [FreeTDS] Description = FreeTDS for Linux Driver = /usr/local/odbc/lib/libtdsodbc.so Setup = /usr/local/odbc/lib/libtdsS.so Create a template file for FreeTDS for odbc.ini [mssql_base] Driver = FreeTDS Description = Microsoft SQL Server Trace = No Server = machine TDS_Version = 8.0 Port= 1433 Database= database_name An entry for any SQL Server Database will need added to odbc.ini Next install DBD::ODBC With the ODBCINI, ODBCHOME, and LD_LIBRARY_PATH set (see above) Install DBD::ODBC using either CPAN or download the module CPAN: perl -MCPAN -e 'force install DBD::ODBC' Reason for the force, is the tests will fail because DBI_DSN, DBI_USER, and DBI_PASS are not set. Running the F
OT: Just testing to see if the list is back...
Test... -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
Re: Oracle 1.15 install problems
> Did you install Oracle properly (i.e. from the CDs or from a > download from technet)? Did you read README.clients as suggested? I installed it from CDs I get from Oracle for linux and the install went smooth. I am able to connect to a remote db via sqlplus..etc. I used the oracle install guide from puschitz.com which several people recommended for redhat 9. I read the readme .clients but it didnt help. There is no oracle.mk file as the readme suggests, and none of the other tidbits in that file applied to me. Below is the actual compile which blows up horribly (as expected after that makefile)... Any ideas? Thanks, Mike -- [EMAIL PROTECTED] DBD-Oracle-1.15]# make cp Oracle.pm blib/lib/DBD/Oracle.pm cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h cp oraperl.ph blib/lib/oraperl.ph cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h cp Oraperl.pm blib/lib/Oraperl.pm cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm /usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver.xst > Oracle.xsi /usr/bin/perl /usr/lib/perl5/5.8.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.0/ExtUtils/typemap -typemap typemap Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c gcc -c -I. -I/opt/oracle/product/9.2.0/precomp/public -I/opt/oracle/product/9.2.0/rdbms/public -I/opt/oracle/product/9.2.0/rdbms/demo -I/opt/oracle/product/9.2.0/plsql/public -I/opt/oracle/product/9.2.0/network/public -I/opt/oracle/product/9.2.0/rdbms/demo -I/opt/oracle/product/9.2.0/rdbms/demo -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -march=i386 -mcpu=i686 -g -DVERSION=\"1.15\" -DXS_VERSION=\"1.15\" -fPIC "-I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE" -DUTF8_SUPPORT Oracle.c In file included from Oracle.h:20, from Oracle.xs:1: dbdimp.h:44:20: ocidfn.h: No such file or directory dbdimp.h:57:21: ociapr.h: No such file or directory In file included from Oracle.h:20, from Oracle.xs:1: dbdimp.h:111: parse error before "Lda_Def" dbdimp.h:111: warning: no semicolon at end of struct or union dbdimp.h:112: warning: data definition has no type or storage class dbdimp.h:120: parse error before '}' token dbdimp.h:144: parse error before "Cda_Def" dbdimp.h:144: warning: no semicolon at end of struct or union dbdimp.h:145: warning: data definition has no type or storage class dbdimp.h:171: parse error before '}' token dbdimp.h:304: parse error before "Lda_Def" In file included from Oracle.c:53: /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h: In function `dbdxst_bind_params':/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:51: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:52: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:56: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:57: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:58: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h: In function `dbdxst_fetchall_arrayref': /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:83: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:84: dereferencing pointer to incomplete type /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBI/Driver_xst.h:91: dereferencing pointer to incomplete type Oracle.xsi: In function `XS_DBD__Oracle__db_selectall_arrayref': Oracle.xsi:135: dereferencing pointer to incomplete type Oracle.xsi: In function `XS_DBD__Oracle__db_selectrow_arrayref': Oracle.xsi:170: dereferencing pointer to incomplete type Oracle.xsi: In function `XS_DBD__Oracle__db_commit': Oracle.xsi:249: dereferencing pointer to incomplete type Oracle.xsi:249: dereferencing pointer to incomplete type Oracle.xsi: In function `XS_DBD__Oracle__db_rollback': Oracle.xsi:259: dereferencing pointer to incomplete type Oracle.xsi:259: dereferencing pointer to incomplete type Oracle.xsi: In function `XS_DBD__Oracle__db_disconnect': Oracle.xsi:269: dereferencing pointer to incomplete type Oracle.xsi:273: dereferencing pointer to incomplete type Oracle.xsi:274: dereferencing pointer to incomplete type Oracle.xsi:275: dereferencing pointer to incomplete type Oracle.xsi:279: dereferencing pointer to incomplete type Oracle.xsi:279: dere
DBD::ODBC, MSSQL, output params
I'm calling some stored procedures using DBI 1.32, DBD::ODBC 1.07 and Perl v5.8.0 (ActivePerl build 805) running on Win2kServer SP4 using MS SQL 2000. Am I supposed to initialize the variables I pass to bind_param_inout()? I'm using code like this to prepare and call the stored procedures and fetch the OUTPUT parameters: sub prepare_sps { $sp{GetLocationInfo_p} = $db->prepare('EXEC dbo.GetLocationInfo '. join(', ',('?') x 5)); # parameters 2-5 are OUTPUT! { my ($JobCity, $JobState, $JobCountry, $JobZIP) = ( " "x 50, " "x 50, " ", " "x 5); my $sp = $sp{GetLocationInfo_p}; $sp->bind_param_inout(2, \$JobCity, 50, DBI::SQL_VARCHAR); $sp->bind_param_inout(3, \$JobState, 50, DBI::SQL_VARCHAR); $sp->bind_param_inout(4, \$JobCountry, 2, DBI::SQL_CHAR); $sp->bind_param_inout(5, \$JobZIP, 5, DBI::SQL_CHAR); $sp{GetLocationInfo} = sub { $sp->bind_param(1, $_[0]); $sp->execute(); $_[1] = $JobCity; $_[2] = $JobState; $_[3] = $JobCountry; $_[4] = $JobZIP; s/^\s+//,s/\s+$// for ($_[1..4]); } }; ... } ... $sp{GetLocationInfo}->($jobLocationId, $JobCity, $JobState, $JobCountry, $JobZIP); The stored proc looks like this: CREATE PROCEDURE dbo.GetMonsterLocationInfo( @LocationID Int, @City varchar(50) OUTPUT, @State varchar(50) OUTPUT, @Country char(2) OUTPUT, @Zip char(5) OUTPUT ) AS BEGIN SELECT @Zip = ZipCode, @State = State, @Country = Country, @City = MappedCity FROM dbo.LocationLookup WITH (NOLOCK) WHERE ID = @LocationID END The problem is that if I do not initialize the $JobXxxx variables with those spaces: my ($JobCity, $JobState, $JobCountry, $JobZIP) = ( " "x 50, " "x 50, " ", " "x 5); I only get the first letters of the values. Once I do initialize the variables I do get the right and complete values even in a loop, even if the value in a later iteration is longer than the one in a previous. I do get the same incorrect results if the variables are undef or "". Why is that? Is this something I missed in the docs? Or is it a bug in DBD::ODBC? Or ...? Thanks, Jenda == [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == I wonder why the whole chemistry industry ignores computer bugs. We all would gladly pay big bucks for a functional insecticide.
Re: Installing DBD-Sybase on Mac OS X AND OCS-12_5
Posting this here so that others can find the information if necessary. Recent versions of ASE on MacOSX have changed the name of the Sybase libs from libct, libcs, etc. to libsybct, libsybcs, etc. DBD::Sybase 1.04 and later detect this change. Some versions of ASE on MacOSX don't include the .dyld libraries, but instead include a Cocoa framework. In order to build DBD::Sybase in this situation you need to add -framework CoreFoundation to the EXTRALIBS and LDLOADLIBS macros in the Makefile generated by running "perl Makefile.PL" and then run "make". Michael On Tue, 2004-08-10 at 15:54, Miguel Covas O'Ryan wrote: > OK, it works but you have to work out where are the libraries. Previous > releases > did nasty things by linking /usr/lib/libct.. to the real thing plus > some issues with the DYLD_LYBRARY_PATH. > > Now you still need to set DYLD_LYBRARY_PATH but they have changed the > library names. > libct is now libsybct, libcs is libsybcs, etc. > > > Since setting EXTRA_LIBS was not enough I changed line 119 in > Makefile.PL > $lib_string = "-L$SYBASE/lib -lsybct -lsybcs -lsybtcl > -lsybcomn -lsybintl $extra -ldl -lm"; > I rather prefer to do this instead of adding something in $extra since > there is still libtcl in > /usr/lib > > I changed checkLib as well so it looks for libsybct. > > It seems that Sybase is showing some interest in Mac OS X. Why do they > change the names of the libraries? > Previous releases used the old standard. Anyway, it works. Nicely. > > > Miguel Covas O'Ryan > > Director de Sistemas de Información > Bancoval, S.A. > Fernando el Santo, 20 > Madrid 28010 > > AVISO LEGAL > Este mensaje de correo electrónico y sus documentos adjuntos están dirigidos > exclusivamente a los destinatarios especificados. Puede contener información > confidencial o legalmente protegida. No hay renuncia a la confidencialidad o > privilegio por cualquier transmisión errónea. Si usted no es el destinatario > indicado, le rogamos que lo elimine y se lo comunique al remitente. No debe, > directa o indirectamente, usar, revelar, distribuir, imprimir o copiar > ninguna de las partes de este mensaje. Si siendo destinatario de este > mensaje no consintiera el uso de correo electrónico, rogamos nos lo > comunique inmediatamente. > Bancoval,S.A. y sus filiales no serán responsables de las opiniones o > informaciones incluidas en este mensaje salvo cuando el remitente esté > autorizado para establecer que dichas opiniones proceden de Bancoval,S.A > y sus filiales. > > DISCLAIMER > Addressee/s identified herein. It may contain confidential or legally > privileged information. No confidentiality privilege is waived or lost > by any mistransmission. If you are not the intended recipient, please > immediately delete it and notify the sender. You must not, directly or > indirectly, disclose, distribute, print, or copy any part of this message. > If you are the addressee of this message and do not consent to the use of > e-mail, please communicate it to us immediately. Bancoval, S.A. and its > subsidiaries are not responsible for the opinions or information included > in this message except when the sender is authorised to state them to be the > views of Bancoval, S.A and its subsidiaries. -- Michael Peppler Data Migrations, Inc. [EMAIL PROTECTED] http://www.peppler.org/ Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or long term contract positions - http://www.peppler.org/resume.html
Derefencing DBI SQL statements
Is there a way to dereference the SQL statement that is send to the DBD? I am loading a master table with 19+ fields and there seem to be a problem at the end of the SQL statement. I want to see what is the DBI/DBD sending to the Database. example: $q3 = $dbh->prepare("INSERT INTO MasterRealtor (@qtColumns, date) VALUES (@Insert,\"$date\")"); $q3->execute or die "ERROR: $q3->errstr \n"; Want to see what the value/string of $q3 is? Tnank you all -Max
DBD::Sybase 1.04.6 -- Production quality?
Hey all, For those of you who have tried the new DBD::Sybase, announced on 4 Aug, would you consider it production quality? I'm currently using 1.02, but am having problems with it hanging against an 11.9.2 server when doing massive non-bulk inserts (50,000+ rows). I figured before I do anything else, I'd upgrade to the latest stable version, which I suppose is 1.03, but if 1.04 is of good quality, I'll upgrade all the way to that... Oh, for those that are wondering, when I say "hanging", I mean that my script just hangs, the process is listed as "sleeping" and I have to restart the server, drop the database and the devices, then recreate the database from scratch. Yes, I've tried doing those things incrementally, and I'm not able to use a database again unless I do all of it. I don't know if it's platform (Win2K AS SP4), perl (AS 5.8.3), DBI (1.42), the DBD (Sybase 1.02), or what, but it does happen. When I upgrade the DBD, I'm also going to upgrade to DBI 1.43. Thanks, amonotod -- `\|||/ amonotod@| sun|perl|windows (@@) charter.net | sysadmin|dba ooO_(_)_Ooo _|_|_|_|_|_|_|_|
fetch entire table
Hi, I would like to know if there is a better way to fetch an entire table to a file (the file has to be tab delimited) instead of using fetchrow_array function? Fetchrow_array is working fine but slow to work with a big table. Thanks, Adam.