Re: DBI DBD-ODBC
[EMAIL PROTECTED] wrote: I created an MSACCESS Database on my Windows XP O/S, set up the System Name in the DATA SOURCES panel associating the Microsoft Access Driver(*.mdb) with my database name (db1). I installed the DBI Module and DBD-ODBC and I still get the following error when I run my PERL script.. Could not make a connection to the database: [Microsoft][ODBC Microsoft Access D river]General error Not enough information to connect to this DSN with SQLConnec t. Use SQLDriverConnect. (SQL-HY000)(DBD: db_login/SQLConnect err=-1) at C:\Do cuments and Settings\O015181\Desktop\Edit1.pl line 8. If anyone knows the reason for this error and how I can fix it, I would appreciate it very much. I am sending this email as a last resort as I have exhausted all of my resources. Regards, Robert V Simmons Did you use: DBI-connect('dbi:ODBC:mydsn'); or DBI-connect('dbi:ODBC:DSN=mydsn'); I would try the latter. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com
Re: DBI DBD-ODBC
I am having almost the same error on a windows 2003 server. Same set of scripts run fine on a Windows XP, the following is the error: DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] 囀湔祛堤 (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at c:\web\factory.pl line 61. it failed at the line to execute after prepared the sql.I wish someone will shed some light on this. Thanks.I am using the format of DBI-connect('dbi:ODBC:mydsn');I think. What is the difference?the sample code as following:my ($dbh, $sth);my $dsn = dbi:ODBC:btn;my $user =;my $pswrd =;my $driver = ODBC;my $wkno;use Time::gmtime;my $ltime=localtime(time);open(LOG,chkorder.log);print LOG $ltime~~$ord_num~~\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\t$ENV{'REMOTE_HTTP_REFERER'}\n;close(LOG);$sql=Select refno, workno,prdcode,prdDesc,duedate from wkMaster WHERE wkmaster.refno like '$ord_num%'; print $starter; $dbh = DBI-connect($dsn,$user,$pswrd,$driver,{RaiseError=1}) or die Database connection not made: $DBI::errstr; $sth = $dbh-prepare($sql); $sth-execute();It failed at the last line shown above. I highly appreciate your help!Samuel - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 3:31 AM Subject: Re: DBI DBD-ODBC [EMAIL PROTECTED] wrote: I created an MSACCESS Database on my Windows XP O/S, set up the System Name in the DATA SOURCES panel associating the Microsoft Access Driver(*.mdb) with my database name (db1). I installed the DBI Module and DBD-ODBC and I still get the following error when I run my PERL script.. Could not make a connection to the database: [Microsoft][ODBC Microsoft Access D river]General error Not enough information to connect to this DSN with SQLConnec t. Use SQLDriverConnect. (SQL-HY000)(DBD: db_login/SQLConnect err=-1) at C:\Do cuments and Settings\O015181\Desktop\Edit1.pl line 8. If anyone knows the reason for this error and how I can fix it, I would appreciate it very much. I am sending this email as a last resort as I have exhausted all of my resources. Regards, Robert V Simmons Did you use: DBI-connect('dbi:ODBC:mydsn'); or DBI-connect('dbi:ODBC:DSN=mydsn'); I would try the latter. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com __ NOD32 2461 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk
Re: DBI DBD-ODBC
Samuel_Zheng wrote: I am having almost the same error on a windows 2003 server. I don't see this as the same. Robert is having a connection problem and you are having an execute problem. Same set of scripts run fine on a Windows XP, the following is the error: DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] 囀湔祛堤 (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at c:\web\factory.pl line 61. As I said when you posted this before - What does 囀湔祛堤 mean in English? Error 22018 in access, is Invalid character value for cast specification which is described for SQLExecute as: StatementText contained a C type that was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type. See http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html#22018 I would be suspicious of the wkmaster.refno like '$ord_num%' in your code. What type is column refno, what is in $ord_num? What does an ODBC trace contain? it failed at the line to execute after prepared the sql.I wish someone will shed some light on this. Thanks.I am using the format of DBI-connect('dbi:ODBC:mydsn');I think. What is the difference? The difference is that DBD::ODBC calls the newer ODBC connection API SQLDriverConnect first then if this fails it attempts to use the older ODBC API SQLConnect. If you are using a DSN then omitting DSN= will cause SQLDriverConnect to attempt to connect using the DEFAULT data source which for most people does not exist and hence fails. When SQLDriverConnect fails DBD::ODBC will have a second attempt with the older ODBC API SQLConnect. I believe this is historical in that initially: DBI-connect('dbi:ODBC:mydsn_name', 'uid', 'pwd') (before ODBC 3) used to call SQLConnect and works fine so long as the DSN mydsn_name exists but SQLConnect is less flexible than the newer SQLDriverConnect which supports new ODBC attributes and driver-specific attributes which are required for say DSN-less connections. the sample code as following:my ($dbh, $sth);my $dsn = dbi:ODBC:btn;my $user =;my $pswrd =;my $driver = ODBC;my $wkno;use Time::gmtime;my $ltime=localtime(time);open(LOG,chkorder.log);print LOG $ltime~~$ord_num~~\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\t$ENV{'REMOTE_HTTP_REFERER'}\n;close(LOG);$sql=Select refno, workno,prdcode,prdDesc,duedate from wkMaster WHERE wkmaster.refno like '$ord_num%'; print $starter; $dbh = DBI-connect($dsn,$user,$pswrd,$driver,{RaiseError=1}) or die Database connection not made: $DBI::errstr; $sth = $dbh-prepare($sql); $sth-execute();It failed at the last line shown above. I highly appreciate your help!Samuel Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com
Re: DBI DBD-ODBC
Yes that is the statement I am using in my PERL script. Robert V Simmons Martin Evans [EMAIL PROTECTED] 08/15/2007 03:31 AM To dbi-users dbi-users@perl.org cc Subject Re: DBI DBD-ODBC [EMAIL PROTECTED] wrote: I created an MSACCESS Database on my Windows XP O/S, set up the System Name in the DATA SOURCES panel associating the Microsoft Access Driver(*.mdb) with my database name (db1). I installed the DBI Module and DBD-ODBC and I still get the following error when I run my PERL script.. Could not make a connection to the database: [Microsoft][ODBC Microsoft Access D river]General error Not enough information to connect to this DSN with SQLConnec t. Use SQLDriverConnect. (SQL-HY000)(DBD: db_login/SQLConnect err=-1) at C:\Do cuments and Settings\O015181\Desktop\Edit1.pl line 8. If anyone knows the reason for this error and how I can fix it, I would appreciate it very much. I am sending this email as a last resort as I have exhausted all of my resources. Regards, Robert V Simmons Did you use: DBI-connect('dbi:ODBC:mydsn'); or DBI-connect('dbi:ODBC:DSN=mydsn'); I would try the latter. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities.
Re: DBI DBD-ODBC
[EMAIL PROTECTED] wrote: Yes that is the statement I am using in my PERL script. Robert V Simmons Can you run your script with DBI_TRACE set to a number = 10 e.g. set DBI_TRACE=10=x.log myperlscript then send me the x.log file. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com *Martin Evans [EMAIL PROTECTED]* 08/15/2007 03:31 AM To dbi-users dbi-users@perl.org cc Subject Re: DBI DBD-ODBC [EMAIL PROTECTED] wrote: I created an MSACCESS Database on my Windows XP O/S, set up the System Name in the DATA SOURCES panel associating the Microsoft Access Driver(*.mdb) with my database name (db1). I installed the DBI Module and DBD-ODBC and I still get the following error when I run my PERL script.. Could not make a connection to the database: [Microsoft][ODBC Microsoft Access D river]General error Not enough information to connect to this DSN with SQLConnec t. Use SQLDriverConnect. (SQL-HY000)(DBD: db_login/SQLConnect err=-1) at C:\Do cuments and Settings\O015181\Desktop\Edit1.pl line 8. If anyone knows the reason for this error and how I can fix it, I would appreciate it very much. I am sending this email as a last resort as I have exhausted all of my resources. Regards, Robert V Simmons Did you use: DBI-connect('dbi:ODBC:mydsn'); or DBI-connect('dbi:ODBC:DSN=mydsn'); I would try the latter. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com
DBD::Sybase install issue
Im trying to install DBD::Sybase, Im getting past perl Makefile.PL - all looks normal. When I try to make I get the following output: cc -c -I/usr/local/include -DSYB_LP64 -DNO_BLK=1 -I/opt/perl/lib/site_perl/5.8.8/x86_64-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\1.08\ -DXS_VERSION=\1.08\ -fpic -I/opt/perl/lib/5.8.8/x86_64-linux/CORE dbdimp.c dbdimp.c: In function `clientmsg_cb': dbdimp.c:328: error: `CS_LOGIN_STATUS' undeclared (first use in this function) dbdimp.c:328: error: (Each undeclared identifier is reported only once dbdimp.c:328: error: for each function it appears in.) make: *** [dbdimp.o] Error 1 uname -a Linux corp-alt-47 2.6.5-7.286-smp #1 SMP Thu May 31 10:12:58 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux perl -v This is perl, v5.8.8 built for x86_64-linux environmental var SYBASE is set to /usr/local Any help is appreciated Ted Fiedler -- If you mess with a thing long enough, it'll break. -- Schmidt
Re: DBD::Sybase install issue
You should always specify if you are using Sybase or FreeTDS client software - I'm guessing the latter. You can work around the issue by adding a #define for CS_LOGIN_STATUS in dbdimp.c. Alternatively this may already have been solved in a more recent version of FreeTDS - you should probably check there. FWIW CS_LOGIN_STATUS should be defined to 9104... Michael Extranet [EMAIL PROTECTED] - 15.08.2007 15:43 To: dbi-users cc: Subject:DBD::Sybase install issue Im trying to install DBD::Sybase, Im getting past perl Makefile.PL - all looks normal. When I try to make I get the following output: cc -c -I/usr/local/include -DSYB_LP64 -DNO_BLK=1 -I/opt/perl/lib/site_perl/5.8.8/x86_64-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\1.08\ -DXS_VERSION=\1.08\ -fpic -I/opt/perl/lib/5.8.8/x86_64-linux/CORE dbdimp.c dbdimp.c: In function `clientmsg_cb': dbdimp.c:328: error: `CS_LOGIN_STATUS' undeclared (first use in this function) dbdimp.c:328: error: (Each undeclared identifier is reported only once dbdimp.c:328: error: for each function it appears in.) make: *** [dbdimp.o] Error 1 uname -a Linux corp-alt-47 2.6.5-7.286-smp #1 SMP Thu May 31 10:12:58 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux perl -v This is perl, v5.8.8 built for x86_64-linux environmental var SYBASE is set to /usr/local Any help is appreciated Ted Fiedler -- If you mess with a thing long enough, it'll break. -- Schmidt This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. Do not print this message unless it is necessary, consider the environment. - Ce message et toutes les pieces jointes (ci-apres le message) sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie. N'imprimez ce message que si necessaire, pensez a l'environnement.
RE: Multiple statements within one $dbh-do()
Thanks. I don't know what I did wrong the first time, but now it is working. Thanks again. Peter -Original Message- From: Garrett, Philip (MAN-Corporate) [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 14, 2007 5:25 PM To: Loo, Peter # PHX; dbi-users@perl.org Subject: RE: Multiple statements within one $dbh-do() Loo, Peter # PHX wrote: Hi, I am trying to execute two SQL statements within one call to $dbh-do() and Perl DBI is not happy. Here is a sample call: $sql = qq{delete from some_table where condition_one andcondition_two; insert into some_table (col_1, col_2, col_3) select col_1, col_2, col_3 from another_table where condition_one andcondition_two;}; Is this possible? I have used multiple statements in the ODBC driver but have not done so in the Oracle driver. Oracle driver is not working. With Oracle, you can use an inline PL/SQL block: $sql = qq{ begin delete from ...; insert ...; end; }; - Philip This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message.
Re: DBI DBD-ODBC
Thank you Martin for your response. 囀湔祛堤 is not readable, no one knows what it means. refno is a string type and $ord_num is also string type contains number characters. e.g. 88090 I just don't understand the same codes run on XP is ok but not on Windows 2003 server. the only thing I can think of is the permision issue. BUT proper rights are given to the a/c runs the script. Samuel - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 8:26 AM Subject: Re: DBI DBD-ODBC Samuel_Zheng wrote: I am having almost the same error on a windows 2003 server. I don't see this as the same. Robert is having a connection problem and you are having an execute problem. Same set of scripts run fine on a Windows XP, the following is the error: DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] 囀湔祛堤 (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at c:\web\factory.pl line 61. As I said when you posted this before - What does 囀湔祛堤 mean in English? Error 22018 in access, is Invalid character value for cast specification which is described for SQLExecute as: StatementText contained a C type that was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type. See http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html#22018 I would be suspicious of the wkmaster.refno like '$ord_num%' in your code. What type is column refno, what is in $ord_num? What does an ODBC trace contain? it failed at the line to execute after prepared the sql.I wish someone will shed some light on this. Thanks.I am using the format of DBI-connect('dbi:ODBC:mydsn');I think. What is the difference? The difference is that DBD::ODBC calls the newer ODBC connection API SQLDriverConnect first then if this fails it attempts to use the older ODBC API SQLConnect. If you are using a DSN then omitting DSN= will cause SQLDriverConnect to attempt to connect using the DEFAULT data source which for most people does not exist and hence fails. When SQLDriverConnect fails DBD::ODBC will have a second attempt with the older ODBC API SQLConnect. I believe this is historical in that initially: DBI-connect('dbi:ODBC:mydsn_name', 'uid', 'pwd') (before ODBC 3) used to call SQLConnect and works fine so long as the DSN mydsn_name exists but SQLConnect is less flexible than the newer SQLDriverConnect which supports new ODBC attributes and driver-specific attributes which are required for say DSN-less connections. the sample code as following:my ($dbh, $sth);my $dsn = dbi:ODBC:btn;my $user =;my $pswrd =;my $driver = ODBC;my $wkno;use Time::gmtime;my $ltime=localtime(time);open(LOG,chkorder.log);print LOG $ltime~~$ord_num~~\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\t$ENV{'REMOTE_HTTP_REFERER'}\n;close(LOG);$sql=Select refno, workno,prdcode,prdDesc,duedate from wkMaster WHERE wkmaster.refno like '$ord_num%'; print $starter; $dbh = DBI-connect($dsn,$user,$pswrd,$driver,{RaiseError=1}) or die Database connection not made: $DBI::errstr; $sth = $dbh-prepare($sql); $sth-execute();It failed at the last line shown above. I highly appreciate your help!Samuel Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com __ NOD32 2463 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk
Re: DBI DBD-ODBC
Samuel_Zheng wrote: Thank you Martin for your response. 囀湔祛堤 is not readable, no one knows what it means. refno is a string type and $ord_num is also string type contains number characters. e.g. 88090 I just don't understand the same codes run on XP is ok but not on Windows 2003 server. the only thing I can think of is the permision issue. BUT proper rights are given to the a/c runs the script. Samuel So try and narrow it down. Does it happen on all values of refno or just one particular one? Does it still happen if you remove the where clause from your select statement altogether. If it is none of that start taking columns out the select - start with duedate. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 8:26 AM Subject: Re: DBI DBD-ODBC Samuel_Zheng wrote: I am having almost the same error on a windows 2003 server. I don't see this as the same. Robert is having a connection problem and you are having an execute problem. Same set of scripts run fine on a Windows XP, the following is the error: DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] 囀湔祛堤 (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at c:\web\factory.pl line 61. As I said when you posted this before - What does 囀湔祛堤 mean in English? Error 22018 in access, is Invalid character value for cast specification which is described for SQLExecute as: StatementText contained a C type that was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type. See http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html#22018 I would be suspicious of the wkmaster.refno like '$ord_num%' in your code. What type is column refno, what is in $ord_num? What does an ODBC trace contain? it failed at the line to execute after prepared the sql.I wish someone will shed some light on this. Thanks.I am using the format of DBI-connect('dbi:ODBC:mydsn');I think. What is the difference? The difference is that DBD::ODBC calls the newer ODBC connection API SQLDriverConnect first then if this fails it attempts to use the older ODBC API SQLConnect. If you are using a DSN then omitting DSN= will cause SQLDriverConnect to attempt to connect using the DEFAULT data source which for most people does not exist and hence fails. When SQLDriverConnect fails DBD::ODBC will have a second attempt with the older ODBC API SQLConnect. I believe this is historical in that initially: DBI-connect('dbi:ODBC:mydsn_name', 'uid', 'pwd') (before ODBC 3) used to call SQLConnect and works fine so long as the DSN mydsn_name exists but SQLConnect is less flexible than the newer SQLDriverConnect which supports new ODBC attributes and driver-specific attributes which are required for say DSN-less connections. the sample code as following:my ($dbh, $sth);my $dsn = dbi:ODBC:btn;my $user =;my $pswrd =;my $driver = ODBC;my $wkno;use Time::gmtime;my $ltime=localtime(time);open(LOG,chkorder.log);print LOG $ltime~~$ord_num~~\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\t$ENV{'REMOTE_HTTP_REFERER'}\n;close(LOG);$sql=Select refno, workno,prdcode,prdDesc,duedate from wkMaster WHERE wkmaster.refno like '$ord_num%'; print $starter; $dbh = DBI-connect($dsn,$user,$pswrd,$driver,{RaiseError=1}) or die Database connection not made: $DBI::errstr; $sth = $dbh-prepare($sql); $sth-execute();It failed at the last line shown above. I highly appreciate your help!Samuel Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com __ NOD32 2463 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk
Re: ShowErrorStatement
Tim Bunce wrote: On Tue, Aug 14, 2007 at 07:01:23PM -0400, Robert Hicks wrote: Tim Bunce wrote: Setting ShowErrorStatement is unrelated to or die... so the question seems flawed. ShowErrorStatement just adds information to the message produced by RaiseError and PrintError. I recommend RaiseError. I recommend ShowErrorStatement. I don't recommend or die ..., generally. If you're using RaiseError then or die ... is redundant. If you're not using RaiseError then ShowErrorStatement is redundant (unless PrintError is on). Hopefully that helps. Maybe that can go in the wiki FAQ? : ) Go ahead... http://dbi.tiddlyspot.com/ :) Umm, guess I should actually announce that new FAQ sometime... Tim. You should...and if you didn't recognize the name; I am the one that helps you with it. ; ) Robert
Re: DBI DBD-ODBC
Thank you for your input. I was going to try what you told me, but it gives this to me now: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. I now give up on Windows 2003 completely. Falling back on the XP. I think I'll reinstalling the server. Samuel - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 10:59 AM Subject: Re: DBI DBD-ODBC Samuel_Zheng wrote: Thank you Martin for your response. 囀湔祛堤 is not readable, no one knows what it means. refno is a string type and $ord_num is also string type contains number characters. e.g. 88090 I just don't understand the same codes run on XP is ok but not on Windows 2003 server. the only thing I can think of is the permision issue. BUT proper rights are given to the a/c runs the script. Samuel So try and narrow it down. Does it happen on all values of refno or just one particular one? Does it still happen if you remove the where clause from your select statement altogether. If it is none of that start taking columns out the select - start with duedate. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 8:26 AM Subject: Re: DBI DBD-ODBC Samuel_Zheng wrote: I am having almost the same error on a windows 2003 server. I don't see this as the same. Robert is having a connection problem and you are having an execute problem. Same set of scripts run fine on a Windows XP, the following is the error: DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] 囀湔祛堤 (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at c:\web\factory.pl line 61. As I said when you posted this before - What does 囀湔祛堤 mean in English? Error 22018 in access, is Invalid character value for cast specification which is described for SQLExecute as: StatementText contained a C type that was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type. See http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html#22018 I would be suspicious of the wkmaster.refno like '$ord_num%' in your code. What type is column refno, what is in $ord_num? What does an ODBC trace contain? it failed at the line to execute after prepared the sql.I wish someone will shed some light on this. Thanks.I am using the format of DBI-connect('dbi:ODBC:mydsn');I think. What is the difference? The difference is that DBD::ODBC calls the newer ODBC connection API SQLDriverConnect first then if this fails it attempts to use the older ODBC API SQLConnect. If you are using a DSN then omitting DSN= will cause SQLDriverConnect to attempt to connect using the DEFAULT data source which for most people does not exist and hence fails. When SQLDriverConnect fails DBD::ODBC will have a second attempt with the older ODBC API SQLConnect. I believe this is historical in that initially: DBI-connect('dbi:ODBC:mydsn_name', 'uid', 'pwd') (before ODBC 3) used to call SQLConnect and works fine so long as the DSN mydsn_name exists but SQLConnect is less flexible than the newer SQLDriverConnect which supports new ODBC attributes and driver-specific attributes which are required for say DSN-less connections. the sample code as following:my ($dbh, $sth);my $dsn = dbi:ODBC:btn;my $user =;my $pswrd =;my $driver = ODBC;my $wkno;use Time::gmtime;my $ltime=localtime(time);open(LOG,chkorder.log);print LOG $ltime~~$ord_num~~\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\t$ENV{'REMOTE_HTTP_REFERER'}\n;close(LOG);$sql=Select refno, workno,prdcode,prdDesc,duedate from wkMaster WHERE wkmaster.refno like '$ord_num%'; print $starter; $dbh = DBI-connect($dsn,$user,$pswrd,$driver,{RaiseError=1}) or die Database connection not made: $DBI::errstr; $sth = $dbh-prepare($sql); $sth-execute();It failed at the last line shown above. I highly appreciate your help!Samuel Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com __ NOD32 2463 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk __ NOD32 2463 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk
Another set of DBI docs
(Those who abhor javadocs should discard this message immediately...) I've been building some tools for fancier Perl project documentation. One piece is a javadoc-ish formatter using special POD tags. In order to exersize it thoroughly, I've hacked a version of DBI to move the POD around a bit, with some editting to comply with javadoc style guidelines. I don't intend to fold any of the changes into the DBI bundle, but thought the resulting docs might be generally useful (which is also why I chose DBI as an unwitting test subject). For anyone interested, here's a link to the result: http://www.presicient.com/dbidocs Caveats: - Some of the internal links aren't valid - older browsers may not play nice with the javascript or CSS (tho they're pretty basic) - Opera doesn't seem to like 12 digit hex color names, so it renders header sections as a hideous purple instead of the usual nice aqua blue - some of the content may not be correct (tho I tried not to change content other than to use slightly different grammar tense or person) I think the docs are useful, if only because of the explorer-style TOC. I know its handy to me to quickly lookup the meaning of an attribute I've forgotten, or to lookup the right parameters for some method. Any comments/corrections/suggestions welcome, but are probably best sent offlist. Regards, Dean Arnold Presicient Corp.
Re: Another set of DBI docs
Hi Dean http://www.presicient.com/dbidocs Very nice! Now all we need is a script, in Perl perhaps, to reformat your work as TiddlyWiki code so it can be grafted into Tim's site... -- Ron Savage [EMAIL PROTECTED] http://savage.net.au/
Re: DBI DBD-ODBC
Hi Sam Thank you for your input. I was going to try what you told me, but it gives this to me now: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. This is not a /new/ error. It just means your program ran long enough to output an error message to the web server /before/ it output the headers expected by the web server. Are you sure you created a system DSN and not a user DSN? After all, the web server, which is running the script, is probably run under control of a different user that you are logged in as. -- Ron Savage [EMAIL PROTECTED] http://savage.net.au/
Re: ShowErrorStatement
On Wed, Aug 15, 2007 at 01:03:03PM -0400, Robert Hicks wrote: Tim Bunce wrote: On Tue, Aug 14, 2007 at 07:01:23PM -0400, Robert Hicks wrote: Tim Bunce wrote: Setting ShowErrorStatement is unrelated to or die... so the question seems flawed. ShowErrorStatement just adds information to the message produced by RaiseError and PrintError. I recommend RaiseError. I recommend ShowErrorStatement. I don't recommend or die ..., generally. If you're using RaiseError then or die ... is redundant. If you're not using RaiseError then ShowErrorStatement is redundant (unless PrintError is on). Hopefully that helps. Maybe that can go in the wiki FAQ? : ) Go ahead... http://dbi.tiddlyspot.com/ :) Umm, guess I should actually announce that new FAQ sometime... Tim. You should...and if you didn't recognize the name; I am the one that helps you with it. ; ) I did Bob. I just thought I'd use the post as an excuse to spread both the url and the message that it's open for editing. Thanks again for helping, and volunteering to be the editor. Must get to work on an announcement... Tim.
Got the following error: unable to realloc 131989419 bytes
Bonjour Tim, I tried to install the DBD-Oracle package today and I got the following error: C:\TEMP\DBD-Oracle-1.16ppm unable to realloc 131989419 bytes This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. My PC has 1.5 GB of RAM and 12 GB of free HD space, 2.4 GHz Intel Core 2 Duo chips, running Windows XP I believe I should be in business to get that running. Oracle info: SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 15 13:33:19 2007 Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production With the Partitioning, OLAP and Data Mining options It installed something because when I go back to ppm after it crashed, I look at the Details of the DBD-Oracle (active) package I have: DBD-Oracle Oracle database driver for the DBI module Version:1.17 Author: Tim Bunce (dbi-users@perl.org) CPAN: http://search.cpan.org/dist/DBD-Oracle-1.17/ Installed files: C:/Perl/html/bin/ora_explain.html C:/Perl/html/site/lib/DBD/Oracle.html C:/Perl/html/site/lib/Oraperl.html C:/Perl/site/bin/ora_explain C:/Perl/site/bin/ora_explain.bat C:/Perl/site/lib/DBD/Oracle.pm C:/Perl/site/lib/DBD/Oracle/GetInfo.pm C:/Perl/site/lib/Oraperl.pm C:/Perl/site/lib/auto/DBD/Oracle/.packlist C:/Perl/site/lib/auto/DBD/Oracle/Oracle.bs C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll C:/Perl/site/lib/auto/DBD/Oracle/Oracle.exp C:/Perl/site/lib/auto/DBD/Oracle/Oracle.h C:/Perl/site/lib/auto/DBD/Oracle/Oracle.lib C:/Perl/site/lib/auto/DBD/Oracle/Oracle.pdb C:/Perl/site/lib/auto/DBD/Oracle/dbdimp.h C:/Perl/site/lib/auto/DBD/Oracle/mk.pm C:/Perl/site/lib/auto/DBD/Oracle/ocitrace.h C:/Perl/site/lib/oraperl.ph What is the root cause of my problem? How can I work around it? Thanks. PM
Re: DBI DBD-ODBC
Thanks Ron. Problem fixed, I was able to run the script after I deleted the DNS server I tried to setup. (silly me) - Original Message - From: Ron Savage [EMAIL PROTECTED] To: dbi-users@perl.org Sent: Wednesday, August 15, 2007 7:59 PM Subject: Re: DBI DBD-ODBC Hi Sam Thank you for your input. I was going to try what you told me, but it gives this to me now: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. This is not a /new/ error. It just means your program ran long enough to output an error message to the web server /before/ it output the headers expected by the web server. Are you sure you created a system DSN and not a user DSN? After all, the web server, which is running the script, is probably run under control of a different user that you are logged in as. -- Ron Savage [EMAIL PROTECTED] http://savage.net.au/ __ NOD32 2464 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk
Re: DBI DBD-ODBC
Martin, I did as you suggested and it ran! But taking out the where clause makes the result not meaningful. I use the 'like' word is to include the records begin with '88090'. Some records may have some Chinese characters after '88090'. Is there another way of doing it? Thanks. Samuel - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 10:59 AM Subject: Re: DBI DBD-ODBC Samuel_Zheng wrote: Thank you Martin for your response. 囀湔祛堤 is not readable, no one knows what it means. refno is a string type and $ord_num is also string type contains number characters. e.g. 88090 I just don't understand the same codes run on XP is ok but not on Windows 2003 server. the only thing I can think of is the permision issue. BUT proper rights are given to the a/c runs the script. Samuel So try and narrow it down. Does it happen on all values of refno or just one particular one? Does it still happen if you remove the where clause from your select statement altogether. If it is none of that start taking columns out the select - start with duedate. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com - Original Message - From: Martin Evans [EMAIL PROTECTED] To: dbi-users dbi-users@perl.org Sent: Wednesday, August 15, 2007 8:26 AM Subject: Re: DBI DBD-ODBC Samuel_Zheng wrote: I am having almost the same error on a windows 2003 server. I don't see this as the same. Robert is having a connection problem and you are having an execute problem. Same set of scripts run fine on a Windows XP, the following is the error: DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] 囀湔祛堤 (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at c:\web\factory.pl line 61. As I said when you posted this before - What does 囀湔祛堤 mean in English? Error 22018 in access, is Invalid character value for cast specification which is described for SQLExecute as: StatementText contained a C type that was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type. See http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html#22018 I would be suspicious of the wkmaster.refno like '$ord_num%' in your code. What type is column refno, what is in $ord_num? What does an ODBC trace contain? it failed at the line to execute after prepared the sql.I wish someone will shed some light on this. Thanks.I am using the format of DBI-connect('dbi:ODBC:mydsn');I think. What is the difference? The difference is that DBD::ODBC calls the newer ODBC connection API SQLDriverConnect first then if this fails it attempts to use the older ODBC API SQLConnect. If you are using a DSN then omitting DSN= will cause SQLDriverConnect to attempt to connect using the DEFAULT data source which for most people does not exist and hence fails. When SQLDriverConnect fails DBD::ODBC will have a second attempt with the older ODBC API SQLConnect. I believe this is historical in that initially: DBI-connect('dbi:ODBC:mydsn_name', 'uid', 'pwd') (before ODBC 3) used to call SQLConnect and works fine so long as the DSN mydsn_name exists but SQLConnect is less flexible than the newer SQLDriverConnect which supports new ODBC attributes and driver-specific attributes which are required for say DSN-less connections. the sample code as following:my ($dbh, $sth);my $dsn = dbi:ODBC:btn;my $user =;my $pswrd =;my $driver = ODBC;my $wkno;use Time::gmtime;my $ltime=localtime(time);open(LOG,chkorder.log);print LOG $ltime~~$ord_num~~\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\t$ENV{'REMOTE_HTTP_REFERER'}\n;close(LOG);$sql=Select refno, workno,prdcode,prdDesc,duedate from wkMaster WHERE wkmaster.refno like '$ord_num%'; print $starter; $dbh = DBI-connect($dsn,$user,$pswrd,$driver,{RaiseError=1}) or die Database connection not made: $DBI::errstr; $sth = $dbh-prepare($sql); $sth-execute();It failed at the last line shown above. I highly appreciate your help!Samuel Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com __ NOD32 2463 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk __ NOD32 2463 (20070815) Information __ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk