cx-oracle-users Mailing List for cx_Oracle (Page 12)
Brought to you by:
atuining
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(9) |
Sep
(8) |
Oct
(12) |
Nov
(4) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(15) |
Feb
(12) |
Mar
(11) |
Apr
(5) |
May
(7) |
Jun
(8) |
Jul
(12) |
Aug
(2) |
Sep
(14) |
Oct
(17) |
Nov
(20) |
Dec
(3) |
2005 |
Jan
(16) |
Feb
(9) |
Mar
(22) |
Apr
(21) |
May
(73) |
Jun
(16) |
Jul
(15) |
Aug
(10) |
Sep
(32) |
Oct
(35) |
Nov
(22) |
Dec
(13) |
2006 |
Jan
(42) |
Feb
(36) |
Mar
(13) |
Apr
(18) |
May
(8) |
Jun
(17) |
Jul
(24) |
Aug
(30) |
Sep
(35) |
Oct
(33) |
Nov
(33) |
Dec
(11) |
2007 |
Jan
(35) |
Feb
(31) |
Mar
(35) |
Apr
(64) |
May
(38) |
Jun
(12) |
Jul
(18) |
Aug
(34) |
Sep
(75) |
Oct
(29) |
Nov
(51) |
Dec
(11) |
2008 |
Jan
(27) |
Feb
(46) |
Mar
(48) |
Apr
(36) |
May
(59) |
Jun
(42) |
Jul
(25) |
Aug
(34) |
Sep
(57) |
Oct
(97) |
Nov
(59) |
Dec
(57) |
2009 |
Jan
(48) |
Feb
(48) |
Mar
(45) |
Apr
(24) |
May
(46) |
Jun
(52) |
Jul
(52) |
Aug
(37) |
Sep
(27) |
Oct
(40) |
Nov
(37) |
Dec
(13) |
2010 |
Jan
(16) |
Feb
(9) |
Mar
(24) |
Apr
(6) |
May
(27) |
Jun
(28) |
Jul
(60) |
Aug
(16) |
Sep
(33) |
Oct
(20) |
Nov
(39) |
Dec
(30) |
2011 |
Jan
(23) |
Feb
(43) |
Mar
(16) |
Apr
(29) |
May
(23) |
Jun
(16) |
Jul
(10) |
Aug
(8) |
Sep
(18) |
Oct
(42) |
Nov
(26) |
Dec
(20) |
2012 |
Jan
(17) |
Feb
(27) |
Mar
|
Apr
(20) |
May
(18) |
Jun
(7) |
Jul
(24) |
Aug
(21) |
Sep
(23) |
Oct
(18) |
Nov
(12) |
Dec
(5) |
2013 |
Jan
(14) |
Feb
(10) |
Mar
(20) |
Apr
(65) |
May
(3) |
Jun
(8) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
(3) |
Nov
(28) |
Dec
(3) |
2014 |
Jan
(3) |
Feb
(9) |
Mar
(4) |
Apr
(7) |
May
(20) |
Jun
(2) |
Jul
(20) |
Aug
(7) |
Sep
(11) |
Oct
(8) |
Nov
(6) |
Dec
(12) |
2015 |
Jan
(16) |
Feb
(10) |
Mar
(14) |
Apr
(8) |
May
|
Jun
(8) |
Jul
(15) |
Aug
(7) |
Sep
(1) |
Oct
(33) |
Nov
(8) |
Dec
(5) |
2016 |
Jan
(18) |
Feb
(12) |
Mar
(6) |
Apr
(14) |
May
(5) |
Jun
(3) |
Jul
|
Aug
(21) |
Sep
|
Oct
(15) |
Nov
(8) |
Dec
|
2017 |
Jan
|
Feb
(14) |
Mar
(21) |
Apr
(9) |
May
(6) |
Jun
(11) |
Jul
(23) |
Aug
(6) |
Sep
(5) |
Oct
(7) |
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(16) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(3) |
2021 |
Jan
|
Feb
(5) |
Mar
|
Apr
(7) |
May
(6) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Andrew W. <and...@fa...> - 2015-12-15 21:05:05
|
Christopher, I'm using cx_Oracle 5.2. I also neglected to mention that I'm running 64 bit python. I have no idea what is magical about 200 in my environment. I'm guessing that I'm exhausting some resource related to our Oracle server but I lack the experience to know what that might be or how to find that out. The CLOBs are created by the query using xmlagg to aggregate some text fields in a related table into a single value for the row. Consequently, the CLOBs aren't a fixed size (they range from 5 to 241 from the rows I'm able to pull; I assume that's in bytes but the cx_Oracle docs don't actually specify the unit). If you have any suggestions as to how I could debug/investigate this further, I would appreciate it. Cheers, Andrew -----Original Message----- From: Christopher Jones [mailto:chr...@or...] Sent: Monday, December 14, 2015 23:04 To: cx-...@li... Subject: Re: [cx-oracle-users] Problem reading CLOB data from query result What's magic about 200 in your environment? What size LOBs? Do you really need to instantiate them all at once in records? What version of cx_Oracle? On 9/12/2015 9:10 am, Andrew Wheelwright wrote: > I'm new to cx_Oracle and am in the process of creating a python script > to pull about 4,000 records from an oracle database for my company. > The query involved uses xmlagg to create two CLOB fields. I'm able to > successfully fetch records one at a time and read the CLOB data for > the first 200 records of the query result but when I try to fetch the > 201^st record I get an Invalid Handle error from cx_Oracle the context > for which is > "LobVar_PreFetch(): free temporary LOB" (I don't know whether that's even useful information). > > My code uses the following logic: > > connection = cx_Oracle.connect('schema/password@server') > > cursor = connection.cursor() > > cursor.execute('my query') > > records = [] > > result = cursor.fetchone() > > while result is not None: > > record = {} > > for index, field in enumerate(result): # convert the result tuple > to a dictionary object > > if field is not None and cursor.description[index][1] == cx_Oracle.CLOB: > > field = field.read() # get the CLOB value > > record[cursor.description[index][0]] = field > > records.append(record) > > result = cursor.fetchone() # <---- Invalid handle error thrown > here > > I suspect the problem I'm hitting is probably due to me going about > handling large objects the wrong way so I appreciate any suggestions or recommendations on better ways to do read CLOB data. > > I'm running python 3.5 on 64 bit Windows 7 > > Thank you for your help, > > Andrew Wheelwright > > > > ---------------------------------------------------------------------- > -------- > > > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge > .net_lists_listinfo_cx-2Doracle-2Dusers&d=CwIF-g&c=z0adcvxXWKG6LAMN6dV > EqQ&r=r8n22QhFUAPJDR_VlIDWddq2o_hv2gm-i73xXR1k6jfSqv6lYXybbcyOCn6zKs-3 > &m=sON8EPilu2DBwG8x01K94bQxjapowKtykSN7Y_yo6IA&s=lHdCJMR7JpgVxukfRkVzr > RaOMllvjJVgN4m2YmZ4bkg&e= > -- https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_ghrd&d=CwIF-g&c=z0adcvxXWKG6LAMN6dVEqQ&r=r8n22QhFUAPJDR_VlIDWddq2o_hv2gm-i73xXR1k6jfSqv6lYXybbcyOCn6zKs-3&m=sON8EPilu2DBwG8x01K94bQxjapowKtykSN7Y_yo6IA&s=XdAQvQbJc9pCldl6o9TJbi4_mEdgxkPJR9NxzxY5MDw&e= ------------------------------------------------------------------------------ _______________________________________________ cx-oracle-users mailing list cx-...@li... https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_cx-2Doracle-2Dusers&d=CwIF-g&c=z0adcvxXWKG6LAMN6dVEqQ&r=r8n22QhFUAPJDR_VlIDWddq2o_hv2gm-i73xXR1k6jfSqv6lYXybbcyOCn6zKs-3&m=sON8EPilu2DBwG8x01K94bQxjapowKtykSN7Y_yo6IA&s=lHdCJMR7JpgVxukfRkVzrRaOMllvjJVgN4m2YmZ4bkg&e= |
From: Christopher J. <chr...@or...> - 2015-12-15 06:04:02
|
What's magic about 200 in your environment? What size LOBs? Do you really need to instantiate them all at once in records? What version of cx_Oracle? On 9/12/2015 9:10 am, Andrew Wheelwright wrote: > I’m new to cx_Oracle and am in the process of creating a python script to pull about 4,000 records from an oracle database for my company. The query > involved uses xmlagg to create two CLOB fields. I’m able to successfully fetch records one at a time and read the CLOB data for the first 200 records > of the query result but when I try to fetch the 201^st record I get an Invalid Handle error from cx_Oracle the context for which is > “LobVar_PreFetch(): free temporary LOB” (I don’t know whether that’s even useful information). > > My code uses the following logic: > > connection = cx_Oracle.connect('schema/password@server') > > cursor = connection.cursor() > > cursor.execute('my query') > > records = [] > > result = cursor.fetchone() > > while result is not None: > > record = {} > > for index, field in enumerate(result): # convert the result tuple to a dictionary object > > if field is not None and cursor.description[index][1] == cx_Oracle.CLOB: > > field = field.read() # get the CLOB value > > record[cursor.description[index][0]] = field > > records.append(record) > > result = cursor.fetchone() # <---- Invalid handle error thrown here > > I suspect the problem I’m hitting is probably due to me going about handling large objects the wrong way so I appreciate any suggestions or > recommendations on better ways to do read CLOB data. > > I’m running python 3.5 on 64 bit Windows 7 > > Thank you for your help, > > Andrew Wheelwright > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > -- http://twitter.com/ghrd |
From: Andrew W. <and...@fa...> - 2015-12-08 22:25:01
|
I'm new to cx_Oracle and am in the process of creating a python script to pull about 4,000 records from an oracle database for my company. The query involved uses xmlagg to create two CLOB fields. I'm able to successfully fetch records one at a time and read the CLOB data for the first 200 records of the query result but when I try to fetch the 201st record I get an Invalid Handle error from cx_Oracle the context for which is "LobVar_PreFetch(): free temporary LOB" (I don't know whether that's even useful information). My code uses the following logic: connection = cx_Oracle.connect('schema/password@server') cursor = connection.cursor() cursor.execute('my query') records = [] result = cursor.fetchone() while result is not None: record = {} for index, field in enumerate(result): # convert the result tuple to a dictionary object if field is not None and cursor.description[index][1] == cx_Oracle.CLOB: field = field.read() # get the CLOB value record[cursor.description[index][0]] = field records.append(record) result = cursor.fetchone() # <---- Invalid handle error thrown here I suspect the problem I'm hitting is probably due to me going about handling large objects the wrong way so I appreciate any suggestions or recommendations on better ways to do read CLOB data. I'm running python 3.5 on 64 bit Windows 7 Thank you for your help, Andrew Wheelwright |
From: Anthony T. <ant...@gm...> - 2015-11-18 03:47:30
|
Nice! Thanks for letting us know. :-) Anthony On Tue, Nov 17, 2015 at 4:08 PM, James C. McPherson < Jam...@or...> wrote: > > Hi everybody, > I'm really pleased to announce that if you are running > Oracle Solaris 11.3 then you can install cx_Oracle v5.2 > in a very simple fashion: > > > # pkg install cx_oracle > > > That will give you both the Python 2.7 (32bit) and Python > 3.4 (64bit) versions, and pull in the Oracle Instant Client > libraries as well if you don't already have them installed. > > The packages are part of the /release repo, you don't need > to have a support contract for Oracle Solaris in order to > download them. > > > Best regards, > James C. McPherson > -- > Oracle > Systems / Solaris / Core > https://www.jmcpdotcom.com/blog > > > ------------------------------------------------------------------------------ > Give your users amazing mobile app experiences with Intel XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2-D/3-D games for multiple OSs. > Then get your creation into app stores sooner, with many ways to monetize. > http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: James C. M. <Jam...@or...> - 2015-11-17 23:08:18
|
Hi everybody, I'm really pleased to announce that if you are running Oracle Solaris 11.3 then you can install cx_Oracle v5.2 in a very simple fashion: # pkg install cx_oracle That will give you both the Python 2.7 (32bit) and Python 3.4 (64bit) versions, and pull in the Oracle Instant Client libraries as well if you don't already have them installed. The packages are part of the /release repo, you don't need to have a support contract for Oracle Solaris in order to download them. Best regards, James C. McPherson -- Oracle Systems / Solaris / Core https://www.jmcpdotcom.com/blog |
From: Eduardo N. <ed...@gm...> - 2015-11-13 14:21:28
|
Thanks Anthony! =) 2015-11-12 15:51 GMT-02:00 Anthony Tuininga <ant...@gm...>: > Hi, > > This is an easy one. :-) > > You are trying to use a version of cx_Oracle compiled for 11g with an > Oracle 10g client. That won't work! Make sure you are using an 11g client > or use a version of cx_Oracle compiled for 10g. > > Anthony > > On Thu, Nov 12, 2015 at 10:00 AM, Eduardo Nascimento <ed...@gm...> > wrote: > >> Gentlemen, I'm trying to connect to a schema, but I'm not getting. I've >> tried a number of ways, but to no avail: >> >> C:\Python27>python.exe >> Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit >> (Intel)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import cx_Oracle >> >>> >> >>> con = cx_Oracle.connect('iris/iris@10.10.160.67/IRSCRPPR') >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >> >> con = cx_Oracle.connect 'iris/iris@10.10.160.67/IRSCRPPR' >> ^ >> SyntaxError: invalid syntax >> >>> con = cx_Oracle.connect (iris/iris@10.10.160.67/IRSCRPPR) >> File "<stdin>", line 1 >> con = cx_Oracle.connect (iris/iris@10.10.160.67/IRSCRPPR) >> ^ >> SyntaxError: invalid syntax >> >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67/IRSCRPPR") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >> >> >>> con = cx_Oracle.connect ("iris/iris@IRSCRPPR") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect >> identifier specified >> >> >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67/IRSCRPPR") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >> >> >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know >> of service requested in connect descriptor >> >> >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67:1521") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know >> of service requested in connect descriptor >> >> >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know >> of service requested in connect descriptor >> >> >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67/IRSCRPPR") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >> >> >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67@IRSCRPPR") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect >> identifier specified >> >> >>> con = cx_Oracle.connect ("iris/iris", "10.10.160.67@IRSCRPPR") >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect >> identifier specified >> >> >>> con = cx_Oracle.connect ('iris','iris', '10.10.160.67','IRSCRPPR') >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> TypeError: an integer is required >> >>> con = cx_Oracle.connect ('iris','iris', '10.10.160.67@IRSCRPPR') >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect >> identifier specified >> >> >> C:\Python27>tnsping 10.10.160.67 >> >> TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on >> 12-NOV-2015 13:40:56 >> >> Copyright (c) 1997, 2005, Oracle. All rights reserved. >> >> Used parameter files: >> C:\oracle\ora102\network\admin\sqlnet.ora >> >> Used HOSTNAME adapter to resolve the alias >> Attempting to contact >> (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=10.10.160.67))(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.160.67)( >> PORT=1521))) >> OK (10 msec) >> >> C:\Python27> >> >> >> ################# with sqlplus I can >> ############ >> >> >> C:\Users\castec>sqlplus "iris/iris@10.10.160.67/IRSCRPPR" >> >> SQL*Plus: Release 10.2.0.1.0 - Production on Thu Nov 12 13:42:55 2015 >> >> Copyright (c) 1982, 2005, Oracle. All rights reserved. >> >> >> Connected to: >> Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit >> Production >> With the Partitioning, OLAP, Data Mining and Real Application Testing >> options >> >> SQL> >> >> >> Please can you help me? >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > > ------------------------------------------------------------------------------ > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Anthony T. <ant...@gm...> - 2015-11-12 17:52:04
|
Hi, This is an easy one. :-) You are trying to use a version of cx_Oracle compiled for 11g with an Oracle 10g client. That won't work! Make sure you are using an 11g client or use a version of cx_Oracle compiled for 10g. Anthony On Thu, Nov 12, 2015 at 10:00 AM, Eduardo Nascimento <ed...@gm...> wrote: > Gentlemen, I'm trying to connect to a schema, but I'm not getting. I've > tried a number of ways, but to no avail: > > C:\Python27>python.exe > Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] > on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import cx_Oracle > >>> > >>> con = cx_Oracle.connect('iris/iris@10.10.160.67/IRSCRPPR') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-24315: illegal attribute type > > con = cx_Oracle.connect 'iris/iris@10.10.160.67/IRSCRPPR' > ^ > SyntaxError: invalid syntax > >>> con = cx_Oracle.connect (iris/iris@10.10.160.67/IRSCRPPR) > File "<stdin>", line 1 > con = cx_Oracle.connect (iris/iris@10.10.160.67/IRSCRPPR) > ^ > SyntaxError: invalid syntax > >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67/IRSCRPPR") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-24315: illegal attribute type > > >>> con = cx_Oracle.connect ("iris/iris@IRSCRPPR") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect > identifier specified > > >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67/IRSCRPPR") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-24315: illegal attribute type > > >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know > of service requested in connect descriptor > > >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67:1521") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know > of service requested in connect descriptor > > >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know > of service requested in connect descriptor > > >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67/IRSCRPPR") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-24315: illegal attribute type > > >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67@IRSCRPPR") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect > identifier specified > > >>> con = cx_Oracle.connect ("iris/iris", "10.10.160.67@IRSCRPPR") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect > identifier specified > > >>> con = cx_Oracle.connect ('iris','iris', '10.10.160.67','IRSCRPPR') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: an integer is required > >>> con = cx_Oracle.connect ('iris','iris', '10.10.160.67@IRSCRPPR') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect > identifier specified > > > C:\Python27>tnsping 10.10.160.67 > > TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on > 12-NOV-2015 13:40:56 > > Copyright (c) 1997, 2005, Oracle. All rights reserved. > > Used parameter files: > C:\oracle\ora102\network\admin\sqlnet.ora > > Used HOSTNAME adapter to resolve the alias > Attempting to contact > (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=10.10.160.67))(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.160.67)( > PORT=1521))) > OK (10 msec) > > C:\Python27> > > > ################# with sqlplus I can > ############ > > > C:\Users\castec>sqlplus "iris/iris@10.10.160.67/IRSCRPPR" > > SQL*Plus: Release 10.2.0.1.0 - Production on Thu Nov 12 13:42:55 2015 > > Copyright (c) 1982, 2005, Oracle. All rights reserved. > > > Connected to: > Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit > Production > With the Partitioning, OLAP, Data Mining and Real Application Testing > options > > SQL> > > > Please can you help me? > > > ------------------------------------------------------------------------------ > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Eduardo N. <ed...@gm...> - 2015-11-12 17:01:06
|
Gentlemen, I'm trying to connect to a schema, but I'm not getting. I've tried a number of ways, but to no avail: C:\Python27>python.exe Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import cx_Oracle >>> >>> con = cx_Oracle.connect('iris/iris@10.10.160.67/IRSCRPPR') Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type con = cx_Oracle.connect 'iris/iris@10.10.160.67/IRSCRPPR' ^ SyntaxError: invalid syntax >>> con = cx_Oracle.connect (iris/iris@10.10.160.67/IRSCRPPR) File "<stdin>", line 1 con = cx_Oracle.connect (iris/iris@10.10.160.67/IRSCRPPR) ^ SyntaxError: invalid syntax >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67/IRSCRPPR") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >>> con = cx_Oracle.connect ("iris/iris@IRSCRPPR") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67/IRSCRPPR") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >>> con = cx_Oracle.connect ("iris/iris@10.10.160.67") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67:1521") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67/IRSCRPPR") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-24315: illegal attribute type >>> con = cx_Oracle.connect ("iris", "iris", "10.10.160.67@IRSCRPPR") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified >>> con = cx_Oracle.connect ("iris/iris", "10.10.160.67@IRSCRPPR") Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified >>> con = cx_Oracle.connect ('iris','iris', '10.10.160.67','IRSCRPPR') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: an integer is required >>> con = cx_Oracle.connect ('iris','iris', '10.10.160.67@IRSCRPPR') Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified C:\Python27>tnsping 10.10.160.67 TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 12-NOV-2015 13:40:56 Copyright (c) 1997, 2005, Oracle. All rights reserved. Used parameter files: C:\oracle\ora102\network\admin\sqlnet.ora Used HOSTNAME adapter to resolve the alias Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=10.10.160.67))(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.160.67)( PORT=1521))) OK (10 msec) C:\Python27> ################# with sqlplus I can ############ C:\Users\castec>sqlplus "iris/iris@10.10.160.67/IRSCRPPR" SQL*Plus: Release 10.2.0.1.0 - Production on Thu Nov 12 13:42:55 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> Please can you help me? |
From: <ejo...@ea...> - 2015-11-03 18:19:07
|
<head><style>body{font-family: Geneva,Arial,Helvetica,sans-serif;font-size:9pt;background-color: #ffffff;color: black;}</style></head><body id="compText"><div><br></div>Thanks for your reply, Amaury...<div><br></div><div>The README file distributed with cx_Oracle states:</div><div><br></div><div><div><span style="font-size: 9pt;">cx_Oracle is a Python extension module that allows access to Oracle and</span></div><div>conforms to the Python database API 2.0 specifications with a number of</div><div>additions. The method cursor.nextset() and the time data type are not</div><div>supported by Oracle and are therefore not implemented.</div><div><br></div><div><br></div><div>Maybe there are sound efficiency reasons why cursor.rowcount doesn't give correct number</div><div>until you have fetched from the cursor - I don't know the nitty-gritty technical details</div><div>inside the cx_Oracle C code, but I can obviously count records after I've fetched them all.</div><div>At the very least, this should be documented as a deviation from the published</div><div>"Python database API 2.0".</div><div><br></div><div>A module that implements the API can't rightly claim to be conforming <span style="font-size: 9pt;">to it if it does things differently.</span></div><div><span style="font-size: 9pt;">I would not call this behavior for cursor.rowcount an "addition".</span></div><div><br></div><div>How are other modules that handle cursor.rowcount as documented in PEP 249 dealing with the issue?</div><div>Other DBs give them access to meta-information that Oracle doesn't?</div><div>Do they run a separate select COUNT(*)?</div><div><br></div><div>I think it would probably be better to do whatever has got to be done to conform with PEP 249, but </div><div>Anthony and others may feel otherwise so, I will just respectfully submit this issue for review by the</div><div>implementors.</div><div><br></div><div>Thanks,</div><div>Erik Johnson</div><div><br></div><blockquote style="padding-left: 5px; margin-left: 0px; border-left: #0000ff 2px solid; font-weight: normal; font-style: normal; text-decoration: none; font-size: 10pt; font-family: arial,sans-serif; color: black;">-----Original Message----- <br>From: Amaury Forgeot d'Arc <ama...@gm...> <br>Sent: Nov 3, 2015 10:01 AM <br>To: ejo...@ea..., cx-...@li... <br>Subject: Re: [cx-oracle-users] cursor.rowcount not functioning as expected <br><br><div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">2015-11-03 17:43 GMT+01:00 <span dir="ltr"><<a target="_blank" href="mailto:ejo...@ea...">ejo...@ea...</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br> I haven't seen any messages on this list for several days.<br> I'm not sure if things are just quiet or I am having issues with the list server.<br></blockquote><div><br></div><div>No, it's just a quiet list. But your question is perfectly on-topic.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> My apologies if this is duplicate - I never saw any response, so I am sending it again.<br> (If this message was already received and there have been responses then I am indeed<br> having mail list issues and I am not sure how to resolve that - please copy any other<br> responses directly to me.)<br> <br> I am starting to use cx_Oracle and happy to have it so, thanks Anthony for sharing your work.<br> <br> Maybe I am not understanding something about the documentation of cursor.rowcount<br> The documentation at:<br> <br> <a target="_blank" href="https://www.python.org/dev/peps/pep-0249/#cursor-attributes" rel="noreferrer">https://www.python.org/dev/peps/pep-0249/#cursor-attributes</a> says:<br> <br> .rowcount<br> This read-only attribute specifies the number of rows that the last .execute*() produced (for DQL statements like SELECT ) or affected (for DML statements like UPDATE or INSERT ).<br></blockquote><div><br></div><div>On the other hand, cxOracle docs say:</div><div>"This read-only attribute specifies the number of rows that have currently been fetched from the cursor (for select statements)..."<br></div><div><a target="_blank" href="http://cx-oracle.readthedocs.org/en/latest/cursor.html#Cursor.rowcount">http://cx-oracle.readthedocs.org/en/latest/cursor.html#Cursor.rowcount</a><br></div><div><br></div><div>This is how Oracle works, there is no way to retrieve the number of rows upfront,</div><div>unless you run a "select count(*)" query.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> <br> I have a cursor variable in the interpreter as 'cur':<br> <br> >>> cur.execute('select * from isotope')<br> <__builtin__.OracleCursor on <cx_Oracle.Connection to some_user@some_sid>><br> >>> cur.rowcount<br> 0<br> >>> recs = cur.fetchall()<br> >>> recs[0]<br> ('Co-55', 'Cobalt 55', None, None)<br> >>> len(recs)<br> 389<br> >>> cur.rowcount<br> 389<br> <br> I think cur.rowcount should return 389 in the first call above.<br> Is that not the right interpretation?<br> <br> Thanks,<br> Erik Johnson<br> <br> ------------------------------------------------------------------------------<br> _______________________________________________<br> cx-oracle-users mailing list<br> <a target="_blank" href="mailto:cx-...@li...">cx-...@li...</a><br> <a target="_blank" href="https://lists.sourceforge.net/lists/listinfo/cx-oracle-users" rel="noreferrer">https://lists.sourceforge.net/lists/listinfo/cx-oracle-users</a><br> </blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Amaury Forgeot d'Arc</div> </div></div> </ama...@gm...></blockquote></div></body> |
From: Amaury F. d'A. <ama...@gm...> - 2015-11-03 17:01:28
|
Hi, 2015-11-03 17:43 GMT+01:00 <ejo...@ea...>: > > I haven't seen any messages on this list for several days. > I'm not sure if things are just quiet or I am having issues with the list > server. > No, it's just a quiet list. But your question is perfectly on-topic. > My apologies if this is duplicate - I never saw any response, so I am > sending it again. > (If this message was already received and there have been responses then I > am indeed > having mail list issues and I am not sure how to resolve that - please > copy any other > responses directly to me.) > > I am starting to use cx_Oracle and happy to have it so, thanks Anthony for > sharing your work. > > Maybe I am not understanding something about the documentation of > cursor.rowcount > The documentation at: > > https://www.python.org/dev/peps/pep-0249/#cursor-attributes says: > > .rowcount > This read-only attribute specifies the number of rows that the last > .execute*() produced (for DQL statements like SELECT ) or affected (for DML > statements like UPDATE or INSERT ). > On the other hand, cxOracle docs say: "This read-only attribute specifies the number of rows that have currently been fetched from the cursor (for select statements)..." http://cx-oracle.readthedocs.org/en/latest/cursor.html#Cursor.rowcount This is how Oracle works, there is no way to retrieve the number of rows upfront, unless you run a "select count(*)" query. > > I have a cursor variable in the interpreter as 'cur': > > >>> cur.execute('select * from isotope') > <__builtin__.OracleCursor on <cx_Oracle.Connection to some_user@some_sid>> > >>> cur.rowcount > 0 > >>> recs = cur.fetchall() > >>> recs[0] > ('Co-55', 'Cobalt 55', None, None) > >>> len(recs) > 389 > >>> cur.rowcount > 389 > > I think cur.rowcount should return 389 in the first call above. > Is that not the right interpretation? > > Thanks, > Erik Johnson > > > ------------------------------------------------------------------------------ > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > -- Amaury Forgeot d'Arc |
From: <ejo...@ea...> - 2015-11-03 16:43:27
|
I haven't seen any messages on this list for several days. I'm not sure if things are just quiet or I am having issues with the list server. My apologies if this is duplicate - I never saw any response, so I am sending it again. (If this message was already received and there have been responses then I am indeed having mail list issues and I am not sure how to resolve that - please copy any other responses directly to me.) I am starting to use cx_Oracle and happy to have it so, thanks Anthony for sharing your work. Maybe I am not understanding something about the documentation of cursor.rowcount The documentation at: https://www.python.org/dev/peps/pep-0249/#cursor-attributes says: .rowcount This read-only attribute specifies the number of rows that the last .execute*() produced (for DQL statements like SELECT ) or affected (for DML statements like UPDATE or INSERT ). I have a cursor variable in the interpreter as 'cur': >>> cur.execute('select * from isotope') <__builtin__.OracleCursor on <cx_Oracle.Connection to some_user@some_sid>> >>> cur.rowcount 0 >>> recs = cur.fetchall() >>> recs[0] ('Co-55', 'Cobalt 55', None, None) >>> len(recs) 389 >>> cur.rowcount 389 I think cur.rowcount should return 389 in the first call above. Is that not the right interpretation? Thanks, Erik Johnson |
From: Anthony T. <ant...@gm...> - 2015-10-29 01:04:16
|
On Wed, Oct 28, 2015 at 6:35 PM, <ejo...@ea...> wrote: > > Sorry, I guess my message earlier today was sort of duplicate - I've got a > bit of lag here. > I have gone back to the list subscription page and changed my option to > not digest, but I still seem to be getting daily digests? > > Anyway, I am starting to use cx_Oracle... > > Am I not understanding something? Documentation at > https://www.python.org/dev/peps/pep-0249/#cursor-attributes says: > > .rowcount > This read-only attribute specifies the number of rows that the last > .execute*() produced (for DQL statements like SELECT ) or affected (for DML > statements like UPDATE or INSERT ). > > > I have a variable in the interpreter 'cur' as my cursor... > > >>> cur.execute('select * from isotope') > <__builtin__.OracleCursor on <cx_Oracle.Connection to some_user@some_sid>> > >>> cur.rowcount > 0 > >>> recs = cur.fetchall() > >>> recs[0] > ('Co-55', 'Cobalt 55', None, None) > >>> len(recs) > 389 > >>> cur.rowcount > 389 > > I think I should have access to 389 as cur.rowcount prior to doing any > fetching from the cursor. > Is that not the right interpretation? > No. Queries do not calculate the total number of rows until *after* they are all fetched. So if cx_Oracle was to do so, every query would result in all of the rows being fetched into memory just so that the rowcount could be set. That would be a poor use of memory! Instead, the value is updated as rows are fetched. You can see that by doing the following: cursor.execute(sql) print(cursor.rowcount) for row in cursor: print(cursor.rowcount) Anthony |
From: <ejo...@ea...> - 2015-10-29 00:35:19
|
Sorry, I guess my message earlier today was sort of duplicate - I've got a bit of lag here. I have gone back to the list subscription page and changed my option to not digest, but I still seem to be getting daily digests? Anyway, I am starting to use cx_Oracle... Am I not understanding something? Documentation at https://www.python.org/dev/peps/pep-0249/#cursor-attributes says: .rowcount This read-only attribute specifies the number of rows that the last .execute*() produced (for DQL statements like SELECT ) or affected (for DML statements like UPDATE or INSERT ). I have a variable in the interpreter 'cur' as my cursor... >>> cur.execute('select * from isotope') <__builtin__.OracleCursor on <cx_Oracle.Connection to some_user@some_sid>> >>> cur.rowcount 0 >>> recs = cur.fetchall() >>> recs[0] ('Co-55', 'Cobalt 55', None, None) >>> len(recs) 389 >>> cur.rowcount 389 I think I should have access to 389 as cur.rowcount prior to doing any fetching from the cursor. Is that not the right interpretation? Thanks, Erik Johnson |
From: Anthony T. <ant...@gm...> - 2015-10-28 18:33:38
|
On Wed, Oct 28, 2015 at 10:41 AM, <ejo...@ea...> wrote: > > I was asking on Friday about trying to get cx_Oracle built with Python > version 2.6.6. Thank you, Shai and Anthony for your responses. > > So, Anthony said this: > > > One other issue that should be considered: if you are trying to use a > > cx_Oracle built with the Python 2.6 you downloaded and built, but using > the > > system wide Python you may run into the difficulty you experienced. If, > > however, you make sure that you build Python with the same configuration > as > > the system wide Python you should be good. > > > > If you run the system wide Python and print the value of sys.maxunicode > you > > should get 1114111 and if you run the one you built then you should get > > 65535 (a different value). > > > > The option you want to the configure command when building Python is > > --enable-unicode=ucs4. > > Once you have enabled that on your personally built Python and confirmed > > that running both gives the same value for sys.maxunicode you should be > > good to go. :-) > > > > And even though I don't personally use Python 2.6 or test with it, there > > shouldn't be any difficulties with using it yet; if there are, let me > know. > > It's not exactly clear but there is sort of an implication here that you > can build cx_Oracle 5.2 with Python 2.7 but run it with Python 2.6.6. > I'm not sure if that's really what was meant, but it does not work. > I got my own 2.7.10 build configured with the ucs4 flag and got > cx_Oracle's setup.py to generate cleanly. When I tried to use the .so > created , the unicode error was gone but then I got this in its place: > > >>> import cx_Oracle > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: ./cx_Oracle.so: undefined symbol: PyCapsule_Import > > > So, if using 5.2 built with 2.7.10 from 2.6.6 is what you meant, > then I am letting you know that there is > a problem with running that (or at least the 2.6.6 that I > have). If that's not what you meant, then nevermind. ;) > It wasn't what I meant. Apologies for the confusion! > > I decided to just back up to cx_Oracle 5.1.2, made my own custom build of > python 2.6.6, "borrowed" its Include/ directory as I showed before, ran > the gcc > commands directly to generate the cx_Oracle.so. That then works with the > system python 2.6.6! > Yes, and if you build cx_Oracle 5.2 with your custom build of Python 2.6.6 it should also work just fine -- unless I inadvertently broke Python 2.6 in the last release, of course! :-) > > So, I am very thankful to have a module to be able to talk to Oracle with. > I had used pyodbc to talk with MS SQL Server systems before, but for some > reason I could never manage to get pyodbc to connect with this Oracle DB. > > Below is a couple of warnings (just FYI) from when I built 5.2 with my > 2.7.10. They are just warnings, but its always nicer to get "warm > fuzzies" as a user rather than "cold pricklies". I'm not sure if there > is anything you can (or want to) change to make these warning going away, > but here's the info in case you do: > > epjohn$ /home/epjohn/src/Python-2.7.10/python setup.py build > running build > running build_ext > building 'cx_Oracle' extension > creating build/temp.linux-x86_64-2.7-11g > gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall > -Wstrict-prototypes -fPIC > -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo > -I/software/app/oracle/product/11.2.0Qv2/rdbms/public > -I/home/epjohn/src/Python-2.7.10/Include -I/home/epjohn/src/Python-2.7.10 > -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o > -DBUILD_VERSION=5.2 > In file included from > /software/app/oracle/product/11.2.0Qv2/rdbms/public/oci.h:3045, > from cx_Oracle.c:10: > /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10795: > warning: function declaration isn't a prototype > /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10801: > warning: function declaration isn't a prototype > creating build/lib.linux-x86_64-2.7-11g > gcc -pthread -shared build/temp.linux-x86_64-2.7-11g/cx_Oracle.o > -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o > build/lib.linux-x86_64-2.7-11g/cx_Oracle.so > Those warnings are from the Oracle include files -- ones we don't control. So nothing much I can do about it! > > Thank you for sharing your work for this module, Anthony! > You're welcome. > > Thanks again, Shai and Anthony, for your responses to my previous email. > You're welcome, again. :-) Anthony |
From: <ejo...@ea...> - 2015-10-28 16:42:03
|
I was asking on Friday about trying to get cx_Oracle built with Python version 2.6.6. Thank you, Shai and Anthony for your responses. So, Anthony said this: > One other issue that should be considered: if you are trying to use a > cx_Oracle built with the Python 2.6 you downloaded and built, but using the > system wide Python you may run into the difficulty you experienced. If, > however, you make sure that you build Python with the same configuration as > the system wide Python you should be good. > > If you run the system wide Python and print the value of sys.maxunicode you > should get 1114111 and if you run the one you built then you should get > 65535 (a different value). > > The option you want to the configure command when building Python is > --enable-unicode=ucs4. > Once you have enabled that on your personally built Python and confirmed > that running both gives the same value for sys.maxunicode you should be > good to go. :-) > > And even though I don't personally use Python 2.6 or test with it, there > shouldn't be any difficulties with using it yet; if there are, let me know. It's not exactly clear but there is sort of an implication here that you can build cx_Oracle 5.2 with Python 2.7 but run it with Python 2.6.6. I'm not sure if that's really what was meant, but it does not work. I got my own 2.7.10 build configured with the ucs4 flag and got cx_Oracle's setup.py to generate cleanly. When I tried to use the .so created , the unicode error was gone but then I got this in its place: >>> import cx_Oracle Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ./cx_Oracle.so: undefined symbol: PyCapsule_Import So, if using 5.2 built with 2.7.10 from 2.6.6 is what you meant, then I am letting you know that there is a problem with running that (or at least the 2.6.6 that I have). If that's not what you meant, then nevermind. ;) I decided to just back up to cx_Oracle 5.1.2, made my own custom build of python 2.6.6, "borrowed" its Include/ directory as I showed before, ran the gcc commands directly to generate the cx_Oracle.so. That then works with the system python 2.6.6! So, I am very thankful to have a module to be able to talk to Oracle with. I had used pyodbc to talk with MS SQL Server systems before, but for some reason I could never manage to get pyodbc to connect with this Oracle DB. Below is a couple of warnings (just FYI) from when I built 5.2 with my 2.7.10. They are just warnings, but its always nicer to get "warm fuzzies" as a user rather than "cold pricklies". I'm not sure if there is anything you can (or want to) change to make these warning going away, but here's the info in case you do: epjohn$ /home/epjohn/src/Python-2.7.10/python setup.py build running build running build_ext building 'cx_Oracle' extension creating build/temp.linux-x86_64-2.7-11g gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo -I/software/app/oracle/product/11.2.0Qv2/rdbms/public -I/home/epjohn/src/Python-2.7.10/Include -I/home/epjohn/src/Python-2.7.10 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.2 In file included from /software/app/oracle/product/11.2.0Qv2/rdbms/public/oci.h:3045, from cx_Oracle.c:10: /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10795: warning: function declaration isn't a prototype /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10801: warning: function declaration isn't a prototype creating build/lib.linux-x86_64-2.7-11g gcc -pthread -shared build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o build/lib.linux-x86_64-2.7-11g/cx_Oracle.so Thank you for sharing your work for this module, Anthony! Thanks again, Shai and Anthony, for your responses to my previous email. Best wishes, Erik Johnson |
From: Anthony T. <ant...@gm...> - 2015-10-26 19:33:11
|
Hi Erik, Not quite. :-) You *NEED* to build with Python 2.6. So make sure you download and build Python 2.6 using the option I indicated. Then things should work well -- barring any other discrepancies in how the system Python and the Python you build are actually built. The easiest method is to have the Python-devel package installed as it will have the options defined there for you -- but if you don't have that option available to you, the next best is to build your own Python 2.6. Good luck! Anthony On Mon, Oct 26, 2015 at 12:15 PM, <ejo...@ea...> wrote: > > Thank you, Shai and Anthony for your responses. > > So, Anthony said this: > > > One other issue that should be considered: if you are trying to use a > > cx_Oracle built with the Python 2.6 you downloaded and built, but using > the > > system wide Python you may run into the difficulty you experienced. If, > > however, you make sure that you build Python with the same configuration > as > > the system wide Python you should be good. > > > > If you run the system wide Python and print the value of sys.maxunicode > you > > should get 1114111 and if you run the one you built then you should get > > 65535 (a different value). > > > > The option you want to the configure command when building Python is > > --enable-unicode=ucs4. > > Once you have enabled that on your personally built Python and confirmed > > that running both gives the same value for sys.maxunicode you should be > > good to go. :-) > > > > And even though I don't personally use Python 2.6 or test with it, there > > shouldn't be any difficulties with using it yet; if there are, let me > know. > > > > > Let's check my understanding... > I think Anthony is saying here that I should be able to get cx_Oracle > built with my own Python 2.7.10, but run that .so with 2.6? > > I'm hoping that's what's implied because it is what I am trying to do... > > WHAT I DID NOW > --------------- > * Rebuilt my own Python 2.7.10 (w/ no args to configure) > * Verified indeed system 2.6.6 has sys.maxunicode of 1114111 > * Verified my python 2.7.10 has sys.maxunicode of 65535 > * re-ran configure w/ --enable-unicode=ucs4 > * My python 2.7.10 now has sys.maxunicode of 1114111 > * ran cx_Oracle 5.2's setup.py with my python 2.7.10 > GOOD => cx_Oracle.so generated cleanly directly without me having to > muck with gcc commands. It does generate a couple of warnings, which > I'm including here in case you want to change anything. (Always nicer > from user's end to receive "warm fuzzies" instead of "cold > pricklies"): > > > epjohn_gpqa1$ /home/epjohn/src/Python-2.7.10/python setup.py build > running build > running build_ext > building 'cx_Oracle' extension > creating build/temp.linux-x86_64-2.7-11g > gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall > -Wstrict-prototypes -fPIC > -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo > -I/software/app/oracle/product/11.2.0Qv2/rdbms/public > -I/home/epjohn/src/Python-2.7.10/Include -I/home/epjohn/src/Python-2.7.10 > -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o > -DBUILD_VERSION=5.2 > In file included from > /software/app/oracle/product/11.2.0Qv2/rdbms/public/oci.h:3045, > from cx_Oracle.c:10: > /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10795: > warning: function declaration isn't a prototype > /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10801: > warning: function declaration isn't a prototype > creating build/lib.linux-x86_64-2.7-11g > gcc -pthread -shared build/temp.linux-x86_64-2.7-11g/cx_Oracle.o > -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o > build/lib.linux-x86_64-2.7-11g/cx_Oracle.so > > > * re-copied the built .so into /home/epjohn/pythonlib > > Now, the issue about Unicode encoding seems to be gone, but I am hitting > the next thing in the chain: > > epjohn_gpqa1$ python > Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> > >>> import sys > >>> sys.path.append('/home/epjohn/pythonlib') > >>> import cx_Oracle > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: ./cx_Oracle.so: undefined symbol: PyCapsule_Import > > > Ummm... I am getting out towards the limit of my expertise here... > This might be helpful: > > epjohn_gpqa1$ ldd cx_Oracle.so > linux-vdso.so.1 => (0x00007ffed0559000) > libclntsh.so.11.1 => > /software/app/oracle/product/11.2.0Qv2/lib/libclntsh.so.11.1 > (0x00007f9e9753f000) > libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9e9730e000) > libc.so.6 => /lib64/libc.so.6 (0x00007f9e96f7a000) > libnnz11.so => > /software/app/oracle/product/11.2.0Qv2/lib/libnnz11.so (0x00007f9e96bad000) > libdl.so.2 => /lib64/libdl.so.2 (0x00007f9e969a8000) > libm.so.6 => /lib64/libm.so.6 (0x00007f9e96724000) > libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f9e9650b000) > libaio.so.1 => /lib64/libaio.so.1 (0x00007f9e96309000) > /lib64/ld-linux-x86-64.so.2 (0x0000003f11200000) > > Indeed, we have an undefined symbol in cx_Oracle.so: > > epjohn_gpqa1$ nm cx_Oracle.so | grep Capsule > U PyCapsule_Import > > I'm not sure where that should be coming from? > I'll see if I can just back up to cx_Oracle 5.1.3 > In the meantime, any other advice? > > Thanks! > > -Erik Johnson > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: <ejo...@ea...> - 2015-10-26 18:16:06
|
Thank you, Shai and Anthony for your responses. So, Anthony said this: > One other issue that should be considered: if you are trying to use a > cx_Oracle built with the Python 2.6 you downloaded and built, but using the > system wide Python you may run into the difficulty you experienced. If, > however, you make sure that you build Python with the same configuration as > the system wide Python you should be good. > > If you run the system wide Python and print the value of sys.maxunicode you > should get 1114111 and if you run the one you built then you should get > 65535 (a different value). > > The option you want to the configure command when building Python is > --enable-unicode=ucs4. > Once you have enabled that on your personally built Python and confirmed > that running both gives the same value for sys.maxunicode you should be > good to go. :-) > > And even though I don't personally use Python 2.6 or test with it, there > shouldn't be any difficulties with using it yet; if there are, let me know. Let's check my understanding... I think Anthony is saying here that I should be able to get cx_Oracle built with my own Python 2.7.10, but run that .so with 2.6? I'm hoping that's what's implied because it is what I am trying to do... WHAT I DID NOW --------------- * Rebuilt my own Python 2.7.10 (w/ no args to configure) * Verified indeed system 2.6.6 has sys.maxunicode of 1114111 * Verified my python 2.7.10 has sys.maxunicode of 65535 * re-ran configure w/ --enable-unicode=ucs4 * My python 2.7.10 now has sys.maxunicode of 1114111 * ran cx_Oracle 5.2's setup.py with my python 2.7.10 GOOD => cx_Oracle.so generated cleanly directly without me having to muck with gcc commands. It does generate a couple of warnings, which I'm including here in case you want to change anything. (Always nicer from user's end to receive "warm fuzzies" instead of "cold pricklies"): epjohn_gpqa1$ /home/epjohn/src/Python-2.7.10/python setup.py build running build running build_ext building 'cx_Oracle' extension creating build/temp.linux-x86_64-2.7-11g gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo -I/software/app/oracle/product/11.2.0Qv2/rdbms/public -I/home/epjohn/src/Python-2.7.10/Include -I/home/epjohn/src/Python-2.7.10 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.2 In file included from /software/app/oracle/product/11.2.0Qv2/rdbms/public/oci.h:3045, from cx_Oracle.c:10: /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10795: warning: function declaration isn't a prototype /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10801: warning: function declaration isn't a prototype creating build/lib.linux-x86_64-2.7-11g gcc -pthread -shared build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o build/lib.linux-x86_64-2.7-11g/cx_Oracle.so * re-copied the built .so into /home/epjohn/pythonlib Now, the issue about Unicode encoding seems to be gone, but I am hitting the next thing in the chain: epjohn_gpqa1$ python Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import sys >>> sys.path.append('/home/epjohn/pythonlib') >>> import cx_Oracle Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ./cx_Oracle.so: undefined symbol: PyCapsule_Import Ummm... I am getting out towards the limit of my expertise here... This might be helpful: epjohn_gpqa1$ ldd cx_Oracle.so linux-vdso.so.1 => (0x00007ffed0559000) libclntsh.so.11.1 => /software/app/oracle/product/11.2.0Qv2/lib/libclntsh.so.11.1 (0x00007f9e9753f000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9e9730e000) libc.so.6 => /lib64/libc.so.6 (0x00007f9e96f7a000) libnnz11.so => /software/app/oracle/product/11.2.0Qv2/lib/libnnz11.so (0x00007f9e96bad000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f9e969a8000) libm.so.6 => /lib64/libm.so.6 (0x00007f9e96724000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f9e9650b000) libaio.so.1 => /lib64/libaio.so.1 (0x00007f9e96309000) /lib64/ld-linux-x86-64.so.2 (0x0000003f11200000) Indeed, we have an undefined symbol in cx_Oracle.so: epjohn_gpqa1$ nm cx_Oracle.so | grep Capsule U PyCapsule_Import I'm not sure where that should be coming from? I'll see if I can just back up to cx_Oracle 5.1.3 In the meantime, any other advice? Thanks! -Erik Johnson |
From: Anthony T. <ant...@gm...> - 2015-10-24 15:51:23
|
Hi Erik, One other issue that should be considered: if you are trying to use a cx_Oracle built with the Python 2.6 you downloaded and built, but using the system wide Python you may run into the difficulty you experienced. If, however, you make sure that you build Python with the same configuration as the system wide Python you should be good. If you run the system wide Python and print the value of sys.maxunicode you should get 1114111 and if you run the one you built then you should get 65535 (a different value). The option you want to the configure command when building Python is --enable-unicode=ucs4. Once you have enabled that on your personally built Python and confirmed that running both gives the same value for sys.maxunicode you should be good to go. :-) And even though I don't personally use Python 2.6 or test with it, there shouldn't be any difficulties with using it yet; if there are, let me know. Anthony On Sat, Oct 24, 2015 at 7:57 AM, Shai Berger <sh...@pl...> wrote: > Hi Erik, > > cx_Oracle 5.2 requires Python 2.7 (or 3.4, but that's obviously not an > option > for you). That is, basically, the incompatibility you're seeing. I'm > guessing > you're using Python 2.6 because you're stuck on a RH 6.X server. > > Regretfully, cx_Oracle does not provide wheels -- meaning, you can't get > official builds for Linux, you need to build them yourself. To get the > missing > Python pieces, you'd need to install the Python development files (headers > and > libraries), I think on RH that's called "python-devel"; you may be able to > convince your system adversaries to install that for you, and then you can > use > "pip install --user" or a virtualenv to build and install cx-Oracle without > system priveleges. > > If you can't do that, perhaps you may be able to find 3rd-party builds of > cx- > Oracle for your RH version -- but that will probably be extra-frowned-upon > by > System; another option I see is to get yourself the equivalent Centos > (maybe > even as a VM on your development machine), build cx-Oracle there, and move > the > binaries to your server. I believe 5.1.3 still works with Python 2.6, but > I'm > not sure. > > HTH, > Shai. > > > On Friday 23 October 2015 22:54:02 ejo...@ea... wrote: > > I am have a pretty rough time of trying to get cx_Oracle build in some > > state I can use. > > > > BACKGROUND: I am directly on the Linux server that is hosting the Oracle > > DB I want to talk to. So, I am not installing any client software, > > thinking I can link directly with the server libraries. > > > > The server has Python 2.6 installed on it, but when trying to run python > > setup.py, I see all sort of complaints about libraries such as Python.h > > and others that it can't find. > > > > I'm not a guru C developer, gcc user or Linux wizard, but I know enough > > to be dangerous. > > > > > > WHAT I HAVE DONE > > So, I don't know why those are not found .h files are not found. > > Indeed, if I dig around on the system, I can't find them. So, I > > figured screw it - I'll just go fetch Python sources myself, which I > > have done for Python 2.6. I then run configure in the python directory, > > which generates pyconfig.h, and I copy that down a level into Include/. > > > > So, then I just hacked the gcc command that was output from python > > setup.py to add this include directory (last argument before -c): > > > > gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall > > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > > --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv > > -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions > > -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic > > -D_GNU_SOURCE -fPIC -fwrapv -fPIC > > -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo > > -I/software/app/oracle/product/11.2.0Qv2/rdbms/public > > -I/usr/include/python2.6 -I/home/epjohn/src/Python-2.6.6/Include -c > > cx_Oracle.c -o build/temp.linux-x86_64-2.6-11g/cx_Oracle.o > > -DBUILD_VERSION=5.2 > > > > This silently generates cx_Oracle.o. > > > > I then run this other gcc command, also seen in setup.py output (appears > > to be to link the .o we just made with the rest of the stuff to make a > > shared object). So, indeed, this will silently generate cx_Oracle.so: > > > > gcc -pthread -shared build/temp.linux-x86_64-2.6-11g/cx_Oracle.o > > -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o > > build/lib.linux-x86_64-2.6-11g/cx_Oracle.so > > > > That seems to be the magic gem I am after. > > I copy that .so into a convenient place at /home/epjohn/pythonlib/ > > But when I try to use it, I get this ugly error message: > > > > epjohn$ python > > Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40) > > [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > > > >>> import sys > > >>> sys.path.append('/home/epjohn/pythonlib') > > >>> import cx_Oracle > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > ImportError: /home/epjohn/pythonlib/cx_Oracle.so: undefined symbol: > > PyUnicodeUCS2_AsEncodedString > > > > Just doing a Google search on PyUnicodeUCS2_AsEncodedString leads > > straight to a StackOverflow article that is (somewhat surprisingly), from > > someone trying to get cx_Oracle installed: > > > > > > > http://stackoverflow.com/questions/7951618/cx-oracle-so-undefined-symbolpy > > unicodeucs2-asencodedstring > > > > I'm not sure I follow every detail there, but the general gist seems to > > be to upgrade to cx_Oracle 5.1. But I'm already at 5.2. > > > > So... as best as I can figure it out, there's some sort of > > incompatibility between the way cx_Oracle module wants to handle Unicode > > strings and the way the default Python installation wants to handle them? > > > > I don't know... that's a guess, but can anybody provide a solution for > > how I can get these two to sync up? > > > > I do not have admin privileges on this machine, so modifying the > > existing Python, installing a new Python, installing cx_Oracle via pip, > > etc. are not options for me. Because of politics, I am basically on my > > own to try to get this going. > > > > (I had tried to first just build my own Python 2.7.10 from source, > > thinking I would then just use pip to install cx_Oracle, but then I ran > > into missing modules, like curses and readline because it couldn't find > > various libraries, and again, I can't seem to locate readline libs on > > this system. So, it is much preferable to just try to get a working > > cx_Oracle.so that the existing Python 2.6.6 can communicate with. That's > > my goal.) > > > > Thank you for reading my email. > > Your time and consideration on this issue is greatly appreciated. > > > > Desperately-hoping-for-some-help-ly, > > Erik Johnson > > > > > > > > > --------------------------------------------------------------------------- > > --- _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------------------------------ > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Shai B. <sh...@pl...> - 2015-10-24 13:57:51
|
Hi Erik, cx_Oracle 5.2 requires Python 2.7 (or 3.4, but that's obviously not an option for you). That is, basically, the incompatibility you're seeing. I'm guessing you're using Python 2.6 because you're stuck on a RH 6.X server. Regretfully, cx_Oracle does not provide wheels -- meaning, you can't get official builds for Linux, you need to build them yourself. To get the missing Python pieces, you'd need to install the Python development files (headers and libraries), I think on RH that's called "python-devel"; you may be able to convince your system adversaries to install that for you, and then you can use "pip install --user" or a virtualenv to build and install cx-Oracle without system priveleges. If you can't do that, perhaps you may be able to find 3rd-party builds of cx- Oracle for your RH version -- but that will probably be extra-frowned-upon by System; another option I see is to get yourself the equivalent Centos (maybe even as a VM on your development machine), build cx-Oracle there, and move the binaries to your server. I believe 5.1.3 still works with Python 2.6, but I'm not sure. HTH, Shai. On Friday 23 October 2015 22:54:02 ejo...@ea... wrote: > I am have a pretty rough time of trying to get cx_Oracle build in some > state I can use. > > BACKGROUND: I am directly on the Linux server that is hosting the Oracle > DB I want to talk to. So, I am not installing any client software, > thinking I can link directly with the server libraries. > > The server has Python 2.6 installed on it, but when trying to run python > setup.py, I see all sort of complaints about libraries such as Python.h > and others that it can't find. > > I'm not a guru C developer, gcc user or Linux wizard, but I know enough > to be dangerous. > > > WHAT I HAVE DONE > So, I don't know why those are not found .h files are not found. > Indeed, if I dig around on the system, I can't find them. So, I > figured screw it - I'll just go fetch Python sources myself, which I > have done for Python 2.6. I then run configure in the python directory, > which generates pyconfig.h, and I copy that down a level into Include/. > > So, then I just hacked the gcc command that was output from python > setup.py to add this include directory (last argument before -c): > > gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv > -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions > -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic > -D_GNU_SOURCE -fPIC -fwrapv -fPIC > -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo > -I/software/app/oracle/product/11.2.0Qv2/rdbms/public > -I/usr/include/python2.6 -I/home/epjohn/src/Python-2.6.6/Include -c > cx_Oracle.c -o build/temp.linux-x86_64-2.6-11g/cx_Oracle.o > -DBUILD_VERSION=5.2 > > This silently generates cx_Oracle.o. > > I then run this other gcc command, also seen in setup.py output (appears > to be to link the .o we just made with the rest of the stuff to make a > shared object). So, indeed, this will silently generate cx_Oracle.so: > > gcc -pthread -shared build/temp.linux-x86_64-2.6-11g/cx_Oracle.o > -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o > build/lib.linux-x86_64-2.6-11g/cx_Oracle.so > > That seems to be the magic gem I am after. > I copy that .so into a convenient place at /home/epjohn/pythonlib/ > But when I try to use it, I get this ugly error message: > > epjohn$ python > Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > >>> import sys > >>> sys.path.append('/home/epjohn/pythonlib') > >>> import cx_Oracle > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: /home/epjohn/pythonlib/cx_Oracle.so: undefined symbol: > PyUnicodeUCS2_AsEncodedString > > Just doing a Google search on PyUnicodeUCS2_AsEncodedString leads > straight to a StackOverflow article that is (somewhat surprisingly), from > someone trying to get cx_Oracle installed: > > > http://stackoverflow.com/questions/7951618/cx-oracle-so-undefined-symbolpy > unicodeucs2-asencodedstring > > I'm not sure I follow every detail there, but the general gist seems to > be to upgrade to cx_Oracle 5.1. But I'm already at 5.2. > > So... as best as I can figure it out, there's some sort of > incompatibility between the way cx_Oracle module wants to handle Unicode > strings and the way the default Python installation wants to handle them? > > I don't know... that's a guess, but can anybody provide a solution for > how I can get these two to sync up? > > I do not have admin privileges on this machine, so modifying the > existing Python, installing a new Python, installing cx_Oracle via pip, > etc. are not options for me. Because of politics, I am basically on my > own to try to get this going. > > (I had tried to first just build my own Python 2.7.10 from source, > thinking I would then just use pip to install cx_Oracle, but then I ran > into missing modules, like curses and readline because it couldn't find > various libraries, and again, I can't seem to locate readline libs on > this system. So, it is much preferable to just try to get a working > cx_Oracle.so that the existing Python 2.6.6 can communicate with. That's > my goal.) > > Thank you for reading my email. > Your time and consideration on this issue is greatly appreciated. > > Desperately-hoping-for-some-help-ly, > Erik Johnson > > > > --------------------------------------------------------------------------- > --- _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: <ejo...@ea...> - 2015-10-23 19:54:16
|
I am have a pretty rough time of trying to get cx_Oracle build in some state I can use. BACKGROUND: I am directly on the Linux server that is hosting the Oracle DB I want to talk to. So, I am not installing any client software, thinking I can link directly with the server libraries. The server has Python 2.6 installed on it, but when trying to run python setup.py, I see all sort of complaints about libraries such as Python.h and others that it can't find. I'm not a guru C developer, gcc user or Linux wizard, but I know enough to be dangerous. WHAT I HAVE DONE So, I don't know why those are not found .h files are not found. Indeed, if I dig around on the system, I can't find them. So, I figured screw it - I'll just go fetch Python sources myself, which I have done for Python 2.6. I then run configure in the python directory, which generates pyconfig.h, and I copy that down a level into Include/. So, then I just hacked the gcc command that was output from python setup.py to add this include directory (last argument before -c): gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo -I/software/app/oracle/product/11.2.0Qv2/rdbms/public -I/usr/include/python2.6 -I/home/epjohn/src/Python-2.6.6/Include -c cx_Oracle.c -o build/temp.linux-x86_64-2.6-11g/cx_Oracle.o -DBUILD_VERSION=5.2 This silently generates cx_Oracle.o. I then run this other gcc command, also seen in setup.py output (appears to be to link the .o we just made with the rest of the stuff to make a shared object). So, indeed, this will silently generate cx_Oracle.so: gcc -pthread -shared build/temp.linux-x86_64-2.6-11g/cx_Oracle.o -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o build/lib.linux-x86_64-2.6-11g/cx_Oracle.so That seems to be the magic gem I am after. I copy that .so into a convenient place at /home/epjohn/pythonlib/ But when I try to use it, I get this ugly error message: epjohn$ python Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.append('/home/epjohn/pythonlib') >>> import cx_Oracle Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: /home/epjohn/pythonlib/cx_Oracle.so: undefined symbol: PyUnicodeUCS2_AsEncodedString Just doing a Google search on PyUnicodeUCS2_AsEncodedString leads straight to a StackOverflow article that is (somewhat surprisingly), from someone trying to get cx_Oracle installed: http://stackoverflow.com/questions/7951618/cx-oracle-so-undefined-symbolpyunicodeucs2-asencodedstring I'm not sure I follow every detail there, but the general gist seems to be to upgrade to cx_Oracle 5.1. But I'm already at 5.2. So... as best as I can figure it out, there's some sort of incompatibility between the way cx_Oracle module wants to handle Unicode strings and the way the default Python installation wants to handle them? I don't know... that's a guess, but can anybody provide a solution for how I can get these two to sync up? I do not have admin privileges on this machine, so modifying the existing Python, installing a new Python, installing cx_Oracle via pip, etc. are not options for me. Because of politics, I am basically on my own to try to get this going. (I had tried to first just build my own Python 2.7.10 from source, thinking I would then just use pip to install cx_Oracle, but then I ran into missing modules, like curses and readline because it couldn't find various libraries, and again, I can't seem to locate readline libs on this system. So, it is much preferable to just try to get a working cx_Oracle.so that the existing Python 2.6.6 can communicate with. That's my goal.) Thank you for reading my email. Your time and consideration on this issue is greatly appreciated. Desperately-hoping-for-some-help-ly, Erik Johnson |
From: greg <mar...@gm...> - 2015-10-22 15:35:32
|
Here's that link: http://kevindalias.com/2014/03/26/how-to-set-up-cx_oracle-for-python-on-mac-os-x-10-89/ e.g., added a line like this at the end of /etc/hosts 127.0.0.1 localhost my-host-name On Thu, Oct 22, 2015 at 11:33 AM, greg <mar...@gm...> wrote: > I think I fixed it. I ended up using this for pip install to make > sure it pulls down a new copy and rebuilds (and maybe gets a later > version??) > > $ pip install --no-cache-dir --allow-external --allow-unverified cx_oracle > > I was then able to import cx_oracle without issues but I was getting > an error "'ORA-21561: OID generation failed'". > > Then I followed the instructions here and added a line with my > hostname to the /etc/hosts file and it all works now. > > -Greg > > On Thu, Oct 22, 2015 at 9:59 AM, greg <mar...@gm...> wrote: >> I'm confused, isn't 5.2 the latest version? which version should I use? >> >> On Thu, Oct 22, 2015 at 9:14 AM, greg <mar...@gm...> wrote: >>> Thanks, that makes a lot of sense. Any idea how to make pip not do >>> that? Maybe I should just specify the latest version? >>> >>> On Wed, Oct 21, 2015 at 1:48 PM, Shai Berger <sh...@pl...> wrote: >>>> Hi Greg, >>>> >>>> It seems to me like your "pip install" command is picking some previously >>>> installed cx-oracle on your system, rather than building a new one. That is >>>> probably why you're getting cx-oracle 5.2 and not the latest version, and that >>>> is why your installation output does not seem to include compilation. >>>> >>>> HTH, >>>> Shai. >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> cx-oracle-users mailing list >>>> cx-...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: greg <mar...@gm...> - 2015-10-22 15:33:17
|
I think I fixed it. I ended up using this for pip install to make sure it pulls down a new copy and rebuilds (and maybe gets a later version??) $ pip install --no-cache-dir --allow-external --allow-unverified cx_oracle I was then able to import cx_oracle without issues but I was getting an error "'ORA-21561: OID generation failed'". Then I followed the instructions here and added a line with my hostname to the /etc/hosts file and it all works now. -Greg On Thu, Oct 22, 2015 at 9:59 AM, greg <mar...@gm...> wrote: > I'm confused, isn't 5.2 the latest version? which version should I use? > > On Thu, Oct 22, 2015 at 9:14 AM, greg <mar...@gm...> wrote: >> Thanks, that makes a lot of sense. Any idea how to make pip not do >> that? Maybe I should just specify the latest version? >> >> On Wed, Oct 21, 2015 at 1:48 PM, Shai Berger <sh...@pl...> wrote: >>> Hi Greg, >>> >>> It seems to me like your "pip install" command is picking some previously >>> installed cx-oracle on your system, rather than building a new one. That is >>> probably why you're getting cx-oracle 5.2 and not the latest version, and that >>> is why your installation output does not seem to include compilation. >>> >>> HTH, >>> Shai. >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: greg <mar...@gm...> - 2015-10-22 13:59:11
|
I'm confused, isn't 5.2 the latest version? which version should I use? On Thu, Oct 22, 2015 at 9:14 AM, greg <mar...@gm...> wrote: > Thanks, that makes a lot of sense. Any idea how to make pip not do > that? Maybe I should just specify the latest version? > > On Wed, Oct 21, 2015 at 1:48 PM, Shai Berger <sh...@pl...> wrote: >> Hi Greg, >> >> It seems to me like your "pip install" command is picking some previously >> installed cx-oracle on your system, rather than building a new one. That is >> probably why you're getting cx-oracle 5.2 and not the latest version, and that >> is why your installation output does not seem to include compilation. >> >> HTH, >> Shai. >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: greg <mar...@gm...> - 2015-10-22 13:14:26
|
Thanks, that makes a lot of sense. Any idea how to make pip not do that? Maybe I should just specify the latest version? On Wed, Oct 21, 2015 at 1:48 PM, Shai Berger <sh...@pl...> wrote: > Hi Greg, > > It seems to me like your "pip install" command is picking some previously > installed cx-oracle on your system, rather than building a new one. That is > probably why you're getting cx-oracle 5.2 and not the latest version, and that > is why your installation output does not seem to include compilation. > > HTH, > Shai. > > ------------------------------------------------------------------------------ > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Os, R v. (Justid) <R....@ju...> - 2015-10-22 06:46:48
|
Hello, Christopher Jones wrote: > Can you log an issue at > https://bitbucket.org/anthony_tuininga/cx_oracle/issues ? > It smells like a Temporary Lob leak. Done: https://bitbucket.org/anthony_tuininga/cx_oracle/issues/27/inserting-clobs-temp-tablespace-usage Regards, Roel > -----Oorspronkelijk bericht----- > Van: Christopher Jones [mailto:chr...@or...] > Verzonden: woensdag 21 oktober 2015 22:40 > Aan: cx-...@li... > Onderwerp: Re: [cx-oracle-users] Inserting CLOBs: temp tablespace usage > keeps increasing > > > > On 14/10/2015 11:32 pm, Os, Roel van (Justid) wrote: > > Hello list, > > > > We've run into an issue with inserting CLOB values in to a table. When we > insert a large number of values into a table with a column with type CLOB, > the temp tablespace usage in Oracle keeps increasing. After a large number > of inserts are performed, Oracle refuses to insert more data, returning a > ORA-01652 error ("unable to extend temp segment"). After our script is > terminated, the temp tablespace is empty again. > > > > The following fragment demonstrates our usage pattern (the for loop is for > testing and is not present in our actual code): > > > > for i in range(count): > > conn = sessionpool.acquire() > > cur = conn.cursor() > > sql_i = 'INSERT INTO SHELVE_TEST("DICTIONARY", "KEY", "VALUE") > VALUES (:d, :k, :v)' > > cur.prepare(sql_i) > > # The following line seems to cause temp tablespace usage to grow: > > cur.setinputsizes(v=cx_Oracle.CLOB) > > > > cur.execute(None, { > > 'd': 'TestDict', > > 'k': 'Key %s' % i, > > 'v': ('Value %s' % i)# * 10 * 1000 * i > > }) > > conn.commit() > > cur.close() > > sessionpool.release(conn) > > > > When we remove the line "cur.setinputsizes(v=cx_Oracle.CLOB)", the > temp tablespace usage stays at zero. We examined the temp tablespace > usage with the following SQL query: > > SELECT * FROM V$TEMPSEG_USAGE; > > > > This shows an entry with SEGTYPE 'LOB_DATA', where the BLOCKS column > keeps increasing. When the script is terminated, the temp tablespace usage > is freed again. > > > > I've attached a simple test script. > > > > Versions: > > * cx_Oracle: 5.2 (also tested with 5.1.1) > > * oracle-instantclient12.1-basiclite 12.1.0.2.0-2 > > * Oracle XE 11.2.0 running on CentOS, also tested on RHEL > > > > Can any of you shed any light on what's happening here? Is there > something we need to be doing to clean up the temp tablespace usage after > inserting? > > > > Regards, > > Roel van Os > > Can you log an issue at > https://bitbucket.org/anthony_tuininga/cx_oracle/issues ? > It smells like a Temporary Lob leak. > > Chris > > -- > http://twitter.com/ghrd > > ------------------------------------------------------------------------------ > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users ________________________________ Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u verzocht dat aan de afzender te melden en het bericht te verwijderen. De Staat aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, die verband houdt met risico's verbonden aan het elektronisch verzenden van berichten. Ministerie van Veiligheid en Justitie This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. The State accepts no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages. Ministry of Security and Justice |