ODBC only working for 82 rows

From: Date: Thu, 22 Mar 2001 17:28:21 +0000
Subject: ODBC only working for 82 rows
Groups: php.general 
Request: Send a blank email to php-general+get-45145@lists.php.net to get a copy of this message
I've kind of hit a wall. I am using the data in an oracle table to create a table in mysql that is equivalent. It only gets thru 82 sometimes 83 records. Doesn't error out or anything, only inserts (and reports back to the screen) 82. There are 134 fields in the table. When i just print out the fieldnames, etc, it prints all of them out. When I try to to alter(add) to the mysql table, it doesn't seem to make it all the way thru. Ideas? -ken Below is the major part of the sql operations. ------------------------------------ $si_oracle_cols = odbc_num_fields($si_oracle_result); PRINT "Colums: $si_oracle_cols<BR>"; /* Print these results to the screen in a nice format */ $i = 1; $result = 0; IF ($si_oracle_cols == 0) : PRINT "No Columns(Fields) returned"; ELSEIF ($si_oracle_cols > 0) : WHILE($i < $si_oracle_cols): $fieldname = odbc_field_name($si_oracle_result, $i); $fieldtype = odbc_field_type($si_oracle_result, $i); IF($fieldtype == "VARCHAR2"): $fieldtype = "VARCHAR"; ENDIF; IF($fieldtype == "NUMBER"): $fieldtype = "INT"; ENDIF; $fieldlen = odbc_field_len($si_oracle_result, $i); PRINT "<br>ColNum: $i "; $mysql_create_si_query = "CREATE TABLE IF NOT EXISTS $si_mysql($fieldname $fieldtype($fieldlen))"; $result = MYSQL_QUERY($mysql_create_si_query); $mysql_alter_si_query = "alter table $si_mysql add($fieldname $fieldtype($fieldlen))"; $alter_result = MYSQL_QUERY($mysql_alter_si_query); $i++; ENDWHILE; PRINT "End of fields"; ENDIF; -----Original Message----- From: Brooks, Ken [mailto:KBrooks@netEPS.com] Sent: Thursday, March 22, 2001 10:16 AM To: php-general@lists.php.net Subject: RE: [PHP] RE: Oracle ODBC sql [ORA-00972: identifier is too long] I got it. I had the table name listed as aradmin_eps_service_instructions when in fact it should have been aradmin.eps_service_instructions (with the dot). I did not know this because all of the tables I had seen linked to this before used _ ,but the actual name (which i normally don't have priveledge to even view) uses the . Whee! -----Original Message----- From: Brooks, Ken [mailto:KBrooks@netEPS.com] Sent: Thursday, March 22, 2001 9:52 AM To: php-general@lists.php.net Subject: RE: [PHP] RE: Oracle ODBC sql [ORA-00972: identifier is too long] Lets start at the basics. What is the easiest way to *make sure* that i am connecting to that oracle db? Anyway I can just list the tables, or something. odbc_tables or something like that?.. -ken -----Original Message----- From: Brooks, Ken [mailto:KBrooks@netEPS.com] Sent: Thursday, March 22, 2001 9:32 AM To: php-general@lists.php.net Subject: [PHP] RE: Oracle ODBC sql [ORA-00972: identifier is too long] I only mentioned the part about the access, just to prove that I know i have a select statement working with an ODBC source. I know that I am connecting to the Oracle database, because if i put in a bogus user/pass i get an error stating so, when I supply the correct credentials I get no errors. So that just leaves something to do with possibly the table names. The exact table name is: ARADMIN_EPS_SERVICE_INSTRUCTIONS by my count that is 32 characters. That could be a problem. Any way around that, or to alias a name to that? (Mind you, i don't have access to that database to change the table names). I can only query from it. The exact offending line number that is returned is 37. 36: $si_oracle_query = "SELECT * FROM ARADMIN_EPS_SERVICE_INSTRUCTIONS where ATMID = 'PN2000'"; 37: $si_oracle_result = odbc_exec($td_oracle, $si_oracle_query); -ken -----Original Message----- From: Greig, Euan [mailto:Euan.Greig@brann.com] Sent: Thursday, March 22, 2001 9:21 AM To: Brooks, Ken Cc: php-general@lists.php.net Subject: [PHP] RE: Oracle ODBC sql [ORA-00972: identifier is too long] I haven't used Oracle with ODBC, but nothing leaps out at me from your code. Some comments/ideas: The full meaning of error 0972 is that the name of a schema object (table, view, username etc) is too long (longer than 30 characters, maybe more for Oracle 8). The query statement you are using looks OK. How about displaying $username and $password? And have you isolated which line is causing the error? The relevance of ' and " I suppose is this. By default Oracle is not case sensitive about the names of database objects, but it is if when you create them you enclose the name in double quotes. For instance if you simply say 'create table euan', then you will be able to access it with 'select * from euan', 'select * from EUAN', 'select * from Euan' etc. But if you say 'create table "euan"', then you will forever have to say 'select * from "euan"'. Problems can indeed arise when interfacing between Access and Oracle, because I believe that Access is case sensitive by default, and Oracle programmers tend not to expect this. But none of this seems very applicable to your case... or is it? -----Original Message----- From: Brooks, Ken [mailto:KBrooks@netEPS.com] Sent: 22 March 2001 14:04 To: 'Greig, Euan'; php-general@lists.php.net Subject: Oracle ODBC sql [ORA-00972: identifier is too long] I'm getting this message when i try to run a query on an Oracle database thru ODBC. I can connect to the database just fine. here is the code i'm trying to use. $td_oracle = odbc_connect($dsn, $username, $password) OR DIE("Unable to connect to oracle aradmin database"); $si_oracle_query = "SELECT * FROM SERVICE_INSTRUCTIONS"; $si_oracle_result = odbc_exec($td_oracle, $si_oracle_query); the result i get is: Warning: SQL error: [Oracle][ODBC Oracle Driver][Oracle OCI]ORA-00972: identifier is too long., SQL state 37000 in SQLExecDirect in c:\program files\apache group\apache\htdocs\odbc_test.php3 on line 34 i'm connecting to an MSAccess database thru odbc just fine and sending a similar query, it works just fine. do i need to do something different because it is an oracle database? (I read somewhere that oracle uses ' and/or " for Identifiers) Is that on the right track? thanks! -ken ************************************************************************** Any opinions expressed in this email are those of the individual and not necessarily the Company. This email and any files transmitted with it, including replies and forwarded copies (which may contain alterations) subsequently transmitted from the Company, are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited. ************************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#45145) next »