cx-oracle-users Mailing List for cx_Oracle (Page 117)
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: matilda m. <ma...@gr...> - 2007-01-23 17:23:09
|
Hi Anthony, thanks for your fast answer. But I really get used to it. :-)) Probably you can remember me as I contacted you by private mail the first time. So, you see, I follow your abuse and mail to the mailing list. :-)) How can I circumvent this problem? How can I even manually increase the buffers? As far as I know, sqlplus does really double the internal buffers to do the communication for the following szenario: DB character set is Latin1 => I can store a maximum of 4000 German umlauts to the a string column. That results in 8000 bytes on the client side if there is a multibyte encoding enabled. How is the buffer size chosen for simple varchar2 columns in cx_Oracle? Best regards Andreas Mock >>> "Anthony Tuininga" <ant...@gm...> 23.01.2007 17:24 >>> Currently only LOBs use the environment's "maxBytesPerCharacter" specification. Unfortunately (as far as I know -- please correct me if I am wrong) varchar2 buffers are limited to 4000 bytes and are specified in bytes, not characters. So you may be able to get away with increasing the buffer size for small strings but for large strings bad things will start to happen. :-) I'm not sure if there is a reasonable way around this or not. If anyone cares to enlighten me I'd be happy to learn. Anyone?? On 1/23/07, matilda matilda <ma...@gr...> wrote: > Hi all, hi Anthony, > > I have the following problem: > > The Oracle database I'm using has the internal encoding > WE8ISO8859P1. The frontend (shell, python) has the > default encoding UTF-8 (NLS_LANG=GERMAN_GERMANY.UTF8). > The Oracle client library is handling encoding convertion, BUT: > If I fetch a varchar2 (byte) column consisting of a character > that is encoded with two bytes in UTF-8, I get the following > error while fetching: > > cx_Oracle.DatabaseError: column at array pos 0 fetched with error: > 1406 > > I think it's a problem with internal buffers of the bind variables. > > 1) What can I do to get rid of that without changing NLS_LANG? > 2) Is there or probably will there a way to transparently circumvent > this problem. (automatic claiming of bigger buffers). > > Thanks in advance > Andreas Mock > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Anthony T. <ant...@gm...> - 2007-01-23 16:24:16
|
Currently only LOBs use the environment's "maxBytesPerCharacter" specification. Unfortunately (as far as I know -- please correct me if I am wrong) varchar2 buffers are limited to 4000 bytes and are specified in bytes, not characters. So you may be able to get away with increasing the buffer size for small strings but for large strings bad things will start to happen. :-) I'm not sure if there is a reasonable way around this or not. If anyone cares to enlighten me I'd be happy to learn. Anyone?? On 1/23/07, matilda matilda <ma...@gr...> wrote: > Hi all, hi Anthony, > > I have the following problem: > > The Oracle database I'm using has the internal encoding > WE8ISO8859P1. The frontend (shell, python) has the > default encoding UTF-8 (NLS_LANG=GERMAN_GERMANY.UTF8). > The Oracle client library is handling encoding convertion, BUT: > If I fetch a varchar2 (byte) column consisting of a character > that is encoded with two bytes in UTF-8, I get the following > error while fetching: > > cx_Oracle.DatabaseError: column at array pos 0 fetched with error: > 1406 > > I think it's a problem with internal buffers of the bind variables. > > 1) What can I do to get rid of that without changing NLS_LANG? > 2) Is there or probably will there a way to transparently circumvent > this problem. (automatic claiming of bigger buffers). > > Thanks in advance > Andreas Mock > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: matilda m. <ma...@gr...> - 2007-01-23 16:00:04
|
Hi all, hi Anthony, I have the following problem: The Oracle database I'm using has the internal encoding WE8ISO8859P1. The frontend (shell, python) has the default encoding UTF-8 (NLS_LANG=GERMAN_GERMANY.UTF8). The Oracle client library is handling encoding convertion, BUT: If I fetch a varchar2 (byte) column consisting of a character that is encoded with two bytes in UTF-8, I get the following error while fetching: cx_Oracle.DatabaseError: column at array pos 0 fetched with error: 1406 I think it's a problem with internal buffers of the bind variables. 1) What can I do to get rid of that without changing NLS_LANG? 2) Is there or probably will there a way to transparently circumvent this problem. (automatic claiming of bigger buffers). Thanks in advance Andreas Mock |
From: Mark H. <mh...@pi...> - 2007-01-18 16:16:10
|
Amaury Forgeot d'Arc wrote: > 2007/1/18, Mark Harrison <mh...@pi...>: >> Is there a difference between calling: >> >> curs.prepare("call set_x1(:a,:b)") >> curs.executemany("call set_x1(:a,:b)", mylist) >> >> and just: >> >> curs.executemany("call set_x1(:a,:b)", mylist) >> >> I know it doesn't make sense, but my test program >> seems to be faster with the prepare. I'm sure it's >> other factors, but I just want to make sure I'm >> not being stupid. >> > > I checked with the cx_Oracle source code, and you seem to be right: > at the C level, there is no difference between the two cases. > Moreover, the additional function call should make the first sample a > little slower. > > BTW, when the statement is prepared, it's better to call executemany > with None instead of repeating the query: > cursor.executemany(None, mylist) > cx_Oracle compare queries by string identity ('is', not '=='). Here > the compiler optimizes the script by sharing the same string for the > two lines. So it should not have any performance impact in this case. Good advice, Thanks! Mark |
From: Amaury F. d'A. <ama...@gm...> - 2007-01-18 09:34:21
|
Hello, Boxhoorn wrote: > > When fetching a NaN number (nan in Python) from a BINARY_FLOAT or BINARY_DOUBLE > column, the following exception is raised. > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > cx_Oracle.DatabaseError: ORA-01722: invalid number > > Similary, fetching Infinity (inf in Python) from a BINARY_FLOAT or BINARY_DOUBLE > column results in > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > cx_Oracle.DatabaseError: OCI-22065: number to text translation for the given format causes overflow > > Inserting Infinity and NaN, however, works flawlessly. cx_Oracle always uses the OciNumber type to exchange numeric values with the database (this is the C equivalent of the NUMBER datatype). Here the error messages comes from the oci layer trying to convert your data into NUMBER values. Well, this won't help you, but I remember Anthony's proposal about following more closely the Python type when creating bind variables: http://sourceforge.net/mailarchive/forum.php?thread_id=30737382&forum_id=34464 I don't know how far he went in this direction, but an easy addition to his proposal is to create a BINARY_DOUBLE bind variable when the python type is 'double'. Then special values should pass unmodified from the database to the python client. Maybe wait for a future relase? -- Amaury Forgeot d'Arc |
From: Amaury F. d'A. <ama...@gm...> - 2007-01-18 09:09:10
|
2007/1/18, Mark Harrison <mh...@pi...>: > Is there a difference between calling: > > curs.prepare("call set_x1(:a,:b)") > curs.executemany("call set_x1(:a,:b)", mylist) > > and just: > > curs.executemany("call set_x1(:a,:b)", mylist) > > I know it doesn't make sense, but my test program > seems to be faster with the prepare. I'm sure it's > other factors, but I just want to make sure I'm > not being stupid. > I checked with the cx_Oracle source code, and you seem to be right: at the C level, there is no difference between the two cases. Moreover, the additional function call should make the first sample a little slower. BTW, when the statement is prepared, it's better to call executemany with None instead of repeating the query: cursor.executemany(None, mylist) cx_Oracle compare queries by string identity ('is', not '=='). Here the compiler optimizes the script by sharing the same string for the two lines. So it should not have any performance impact in this case. -- Amaury Forgeot d'Arc |
From: Mark H. <mh...@pi...> - 2007-01-18 07:27:00
|
Is there a difference between calling: curs.prepare("call set_x1(:a,:b)") curs.executemany("call set_x1(:a,:b)", mylist) and just: curs.executemany("call set_x1(:a,:b)", mylist) I know it doesn't make sense, but my test program seems to be faster with the prepare. I'm sure it's other factors, but I just want to make sure I'm not being stupid. Many TIA! Mark -- Mark Harrison Pixar Animation Studios |
From: Jesse G. L. <jg...@be...> - 2007-01-17 17:06:16
|
On Wed, 17 Jan 2007 11:38:05 +0100 "Amaury Forgeot d'Arc" <ama...@gm...> wrote: > 2007/1/16, Jesse G. Lands <jg...@be...>: > > I have some code that works fine when I query, but when try an > > update statement I get a response back of > > "Expecting string or none" > > > > my code looks something like this > > [code] > > > > import cx_Oracle > > from pprint import pprint > > xl = readexcel('users701.xls') > > sheetnames = xl.worksheets() > > dbuser = 'user/password@blue' > > connect = cx_Oracle.Connection("%s" % (dbuser)) > > cursor = cx_Oracle.Cursor(connect) > > i = 1 > > for sheet in sheetnames: > > > > for row in xl.getiter(sheet): > > #sql = "select * from T_PERSONNEL" > > if (i > 50): > > break > > sql = """UPDATE T_PERSONNEL SET last_name = > > '%s',first_name = '%s' WHERE login = '%s'""" % (row['Last Name'], > > row['First Name'], row['ID']) > > print sql, cursor.execute(sql) > > #data = cursor.fetchall() > > #pprint(data) > > i = i + 1 > > One possibility is that your query is actually a unicode string. > This happens if your excel data are returned as unicode. > Unicode query are not (yet) supported by cx_Oracle. > I suggest to try a conversion to string: > cursor.execute(str(sql)) > That seemed to work. The only other problem I had was that the list names contained spaces. So I needed to modify the excel spreadsheet to fix this. Thank you very much for your help. -- JLands Arch Current Registered Linux User #290053 "It is better to be feared than loved, if you cannot be both." - Niccolo Machiavelli (1469-1527), "The Prince" |
From: Amaury F. d'A. <ama...@gm...> - 2007-01-17 10:38:10
|
2007/1/16, Jesse G. Lands <jg...@be...>: > I have some code that works fine when I query, but when try an update > statement I get a response back of > "Expecting string or none" > > my code looks something like this > [code] > > import cx_Oracle > from pprint import pprint > xl = readexcel('users701.xls') > sheetnames = xl.worksheets() > dbuser = 'user/password@blue' > connect = cx_Oracle.Connection("%s" % (dbuser)) > cursor = cx_Oracle.Cursor(connect) > i = 1 > for sheet in sheetnames: > > for row in xl.getiter(sheet): > #sql = "select * from T_PERSONNEL" > if (i > 50): > break > sql = """UPDATE T_PERSONNEL SET last_name = > '%s',first_name = '%s' WHERE login = '%s'""" % (row['Last Name'], > row['First Name'], row['ID']) > print sql, cursor.execute(sql) > #data = cursor.fetchall() > #pprint(data) > i = i + 1 One possibility is that your query is actually a unicode string. This happens if your excel data are returned as unicode. Unicode query are not (yet) supported by cx_Oracle. I suggest to try a conversion to string: cursor.execute(str(sql)) -- Amaury Forgeot d'Arc |
From: Jesse G. L. <jg...@be...> - 2007-01-17 09:44:43
|
On Wed, 17 Jan 2007 10:32:03 +0100 <dan...@co...> wrote: > On Tuesday, January 16, 2007 10:15 PM, Jesse G. Lands wrote: > > > I have some code that works fine when I query, but when try an > > update statement I get a response back of > > "Expecting string or none" > > [snip] > > > sql = """UPDATE T_PERSONNEL SET last_name = > > '%s',first_name = '%s' WHERE login = '%s'""" % (row['Last Name'], > > row['First Name'], row['ID']) > > print sql > > cursor.execute(sql) > > I am not sure about the readexcel() functionality, but I assume > row['ID'] returns a number and not a string. > > I strongly recommend to use bind variables instead of constructing the > SQL string manually. It is faster and safer. Refer for example to > http://www.joelonsoftware.com/items/2006/11/01.html for an explanation > why bind variables are the way to go. > > So a better approach would be: > > sql = """ > UPDATE T_PERSONNEL > SET last_name = :lastname, > first_name = :firstname > WHERE login = :login > """ > cursor.prepare(sql) > for sheet in sheetnames: > for row in xl.getiter(sheet): > cursor.execute(None, [ > row['Last Name'], > row['First Name'], > row['ID'] > ]) > cursor.close() > > Now implicit data type conversion takes place, if necessary. Of course > you can always make explicit data type conversion if you would like > to. > > HTH, > Daniel Daniel, ID actually refers to a login ID for a gui frontend to the Oracle database. They are something along the lines of "User001" so strings and not numbers. Thanks for the suggestion though. I will look at implementing your change recommendation. Jesse -- JLands Arch Current Registered Linux User #290053 We fashion wood for a house, but it is the emptiness inside that makes it livable. |
From: <dan...@co...> - 2007-01-17 09:32:30
|
On Tuesday, January 16, 2007 10:15 PM, Jesse G. Lands wrote: > I have some code that works fine when I query, but when try an update > statement I get a response back of > "Expecting string or none" [snip] > sql =3D """UPDATE T_PERSONNEL SET last_name =3D > '%s',first_name =3D '%s' WHERE login =3D '%s'""" % (row['Last Name'], > row['First Name'], row['ID']) > print sql > cursor.execute(sql) I am not sure about the readexcel() functionality, but I assume row['ID'] returns a number and not a string. I strongly recommend to use bind variables instead of constructing the SQL string manually. It is faster and safer. Refer for example to http://www.joelonsoftware.com/items/2006/11/01.html for an explanation why bind variables are the way to go. So a better approach would be: sql =3D """ UPDATE T_PERSONNEL SET last_name =3D :lastname, first_name =3D :firstname WHERE login =3D :login """ cursor.prepare(sql) for sheet in sheetnames: for row in xl.getiter(sheet): cursor.execute(None, [ row['Last Name'], row['First Name'], row['ID'] ]) cursor.close() Now implicit data type conversion takes place, if necessary. Of course you can always make explicit data type conversion if you would like to. HTH, Daniel |
From: Jesse G. L. <jg...@be...> - 2007-01-17 02:11:54
|
I have some code that works fine when I query, but when try an update statement I get a response back of "Expecting string or none" my code looks something like this [code] import cx_Oracle from pprint import pprint xl = readexcel('users701.xls') sheetnames = xl.worksheets() dbuser = 'user/password@blue' connect = cx_Oracle.Connection("%s" % (dbuser)) cursor = cx_Oracle.Cursor(connect) i = 1 for sheet in sheetnames: for row in xl.getiter(sheet): #sql = "select * from T_PERSONNEL" if (i > 50): break sql = """UPDATE T_PERSONNEL SET last_name = '%s',first_name = '%s' WHERE login = '%s'""" % (row['Last Name'], row['First Name'], row['ID']) print sql cursor.execute(sql) #data = cursor.fetchall() #pprint(data) i = i + 1 cursor.close() connect.commit() [/code] The commented parts is for testing. Just left it in to keep myself straight. I had to put in the if statement because it continues to run the excel spreadsheet even through blank entries. Any help is appreciated. -- JLands Arch Current Registered Linux User #290053 Success is as dangerous as failure, and we are often our own worst enemy. |
From: Gregg Z. <gre...@ya...> - 2007-01-13 04:33:05
|
Daniel,=0A=0AThanks for the assist. I rewrote the code and moved the connec= tions to the top. I closed the cursors as necessary and the script runs wit= hout a hitch. It was definitely those connections stepping on one another.= =0A=0ABest regards,=0A=0AGregg=0A=0A----- Original Message ----=0AFrom: "da= nie...@co..." <dan...@co...>=0ATo: cx-oracle-users@= lists.sourceforge.net=0ASent: Friday, January 12, 2007 3:25:49 AM=0ASubject= : Re: [cx-oracle-users] Fw: cx_oracle question - cx_Oracle.DatabaseError=0A= =0AOn Friday, January 12, 2007 6:39 AM, Gregg Ziliani wrote:=0A=0A> Now I d= o not have problems with connecting to the database in any of=0A> the other= python scripts for this website. Is it an issue of opening=0A> too many co= nnections to Oracle within the same script? =0A=0ASince I do not know your = data, I can not see how often cx_Oracle.connect=0Agets called. But looking = at your cron.py code, this could be a problem.=0A=0AOpen the connection ONC= E at the start of the script (before _auto()) and=0Athen use this global co= nnection variable every where in this script.=0AAnother good idea is to exp= licitly close all your cursors to avoid the=0A'too many open cursors' probl= em.=0A=0ALets see whether this works better.=0A=0ADaniel=0A=0A-------------= ------------------------------------------------------------=0ATake Surveys= . Earn Cash. Influence the Future of IT=0AJoin SourceForge.net's Techsay pa= nel and you'll get the chance to share your=0Aopinions on IT & business top= ics through brief surveys - and earn cash=0Ahttp://www.techsay.com/default.= php?page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV=0A________________________= _______________________=0Acx-oracle-users mailing list=0Acx-oracle-users@li= sts.sourceforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/cx-oracl= e-users=0A=0A=0A=0A=0A=0A=0A=0A =0A________________________________________= ____________________________________________=0ATV dinner still cooling? =0A= Check out "Tonight's Picks" on Yahoo! TV.=0Ahttp://tv.yahoo.com/ |
From: D.R. B. <da...@as...> - 2007-01-12 14:50:17
|
When fetching a NaN number (nan in Python) from a BINARY_FLOAT or BINARY_DOUBLE column, the following exception is raised. Traceback (most recent call last): File "<stdin>", line 1, in ? cx_Oracle.DatabaseError: ORA-01722: invalid number Similary, fetching Infinity (inf in Python) from a BINARY_FLOAT or BINARY_DOUBLE column results in Traceback (most recent call last): File "<stdin>", line 1, in ? cx_Oracle.DatabaseError: OCI-22065: number to text translation for the given format causes overflow Inserting Infinity and NaN, however, works flawlessly. I've only tried this for cx_Oracle 4.2.1 & 4.1.2, Python 2.3 and Oracle 10gR2, but it would not be surprising if other combinations show the same behaviour. Does anyone have an idea for a solution or clever workaround? Thanks Danny Using cx_Oracle 4.2.1 On Thu, Dec 07, 2006 at 09:30:17AM +0100, Henning von Bargen wrote: > Hi Mark, > > pls try the following script: > ============================================= > > #!/bin/env python > # -*- coding: iso-8859-1 -*- > # > import cx_Oracle > > # Sample 1 > def doAllCurs (curs, stmt, **args): > rset = curs.execute (stmt, **args) > for rec in curs: > yield rec > return > > # Sample 2 > def doAllConn (conn, stmt, **args): > curs = conn.cursor() > for rec in doAllCurs(curs, stmt, **args): > yield rec > curs.close() > return > > # Print All Records > # This could perhaps be recoded in a more functional programming style > def printAll (curs, stmt, **args): > for rec in doAllCurs(curs, stmt, **args): > print rec > > def test (uid, query, **bindvars): > conn = cx_Oracle.connect(uid) > curs = conn.cursor() > printAll (curs, query, **bindvars) > > print "" > print "The first 20 records as a list:" > print list (doAllCurs (curs, query, **bindvars))[:20] > > curs.close() > conn.close() > > # Test me > if __name__ == "__main__": > import sys > if len(sys.argv) > 1: > uid = sys.argv[1] > conditions = dict ([tuple(arg.split("=",1)) > for arg in sys.argv[2:] > ]) > query = """ > select object_name > , object_type > from user_objects > where 1=1""" > for nam,val in conditions.items(): > query += ("\n and %s = :%s" % (nam,nam)) > print "Query:" > print query > print "*" * 70 > print "Bind Vars:" > for nam,val in conditions.items(): > print "%-20s = %r" % (nam,val) > print "*" * 70 > test (uid, query, **conditions); > else: > print "Test me like this:" > print "%s uid/pwd@dbs object_type=TABLE" % sys.argv[0] > > ============================================= > > Just save it as test.py, then call it like > test.py userid/password@database object_type=TABLE > > or, with other condiditons: > test.py userid/password@database object_type=TABLE object_name=XYZ > (This will probably not return any results) > > HTH > Henning > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: <dan...@co...> - 2007-01-12 08:26:11
|
On Friday, January 12, 2007 6:39 AM, Gregg Ziliani wrote: > Now I do not have problems with connecting to the database in any of > the other python scripts for this website. Is it an issue of opening > too many connections to Oracle within the same script?=20 Since I do not know your data, I can not see how often cx_Oracle.connect gets called. But looking at your cron.py code, this could be a problem. Open the connection ONCE at the start of the script (before _auto()) and then use this global connection variable every where in this script. Another good idea is to explicitly close all your cursors to avoid the 'too many open cursors' problem. Lets see whether this works better. Daniel |
From: Anthony T. <ant...@gm...> - 2007-01-02 15:56:30
|
I have turned off posting from non-members in an attempt to limit spam since there seems to have been a lot of it lately. Apologies for the inconvenience. Anthony Tuininga |
From: Eve D. G. <fg...@to...> - 2007-01-02 12:44:00
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <img alt="torturer" src="cid:par...@to..." height="247" width="542"><br> There are two solutions to our problem. One of the most productive uses of blog software as a content management system is for an online media room.<br> How can anyone protect their reputable, newsworthy sites from having this happen to them. Select the rule you wish to modify, right-click and select Edit Rule.<br> </body> </html> |
From: Tommy <zr...@21...> - 2007-01-01 18:45:32
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <img alt="truncated" src="cid:par...@21..." height="206" width="554"><br> DNA or saliva could be good options, but the company providing such an ink would be liable for handling hazardous materials.<br> This is an awesome place, and those ghosts are look like they wood just start swaying.<br> Find a clever subtitle to explain what is the book about.<br> the condition or fact of being," according to the Barnhart Dictionary of Etymology. That's a wasted trouble.<br> Many stupid enterprises were carried out by stupids wanted to set another stupid record, but no one decided to fly with its legs. offers Leadership at Sheraton, Time Management and Improving Communication Skills courses .<br> The additional components that add safety to the OwnInk system are substances that are easy to detect, if you know what you are looking for. It is not clear how will Notaries perform when the rules of their business get turned upside down.<br> The Bible is God's roadmap for growth in your life.<br> SALUKIS RALLY PAST UT-MARTINHome:: Web Directory:: footballdaily News:: Free RSS news:: Free Newsletter:: Tell a FriendClientfinder.<br> Notorious gangster John Dillinger had his fingerprints removed with acid, but they grew back. The handles can be enlarged by any long piece of wood, such as broom handles.<br> BARCA REMAIN TOP OF THE PILEHome:: Web Directory:: footballdaily News:: Free RSS news:: Free Newsletter:: Tell a FriendClientfinder. The inventor said that 128 mb of memory will be more than enough for this distance. predatory lender Household International.<br> comNomeSearchPowered by:: Free RSS newsAdd RSS news to your web sitefootballdaily news vertical portal can now be syndicated quickly and easily using our new Really Simple Syndication feeds.<br> After you submit the comment, check your email.<br> SALUKIS RALLY PAST UT-MARTINHome:: Web Directory:: footballdaily News:: Free RSS news:: Free Newsletter:: Tell a FriendClientfinder.<br> </body> </html> |
From: Dawson J. A. <zm...@mp...> - 2006-12-29 13:15:45
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <img alt="prairie" src="cid:par...@mp..." height="303" width="615"><br> So you have to design the form around this fact. Classic centrefold stuff with a magic ingredient. Share this post: email it!<br> Net developers please!<br> All three levels of cinnamon showed results, leading researchers to believe that as little as 1 gram a day of cinnamon may benefit people who have Type 2. I prefer the other covers, but this shoot is personal and you get some up close and behind the scenes shots of the beautiful Stott.<br> I prefer the other covers, but this shoot is personal and you get some up close and behind the scenes shots of the beautiful Stott.<br> jpg Viewed: 158 times. I found a lot of helpful links on the web, but non of them exactly what I wanted. " and has been saying this all the time in her little baby voice "oh de-ar, oh de-ar" so sweet.<br> jpg Viewed: 2476 times.<br> We tell her and she picks most words up after a few goes. Never drink on an empty stomach.<br> They don't have to be topless, and we don't want to see any underage or hardcore filth on here.<br> In addition to ground cinnamon consumed directly, one can also make a cinnamon tea and let the solids settle to the bottom or use cinnamon sticks, which make for a nice clear tea. I've seen this link before, but thus far I've been too lazy to read through them.<br> The mid bottom shot is probably the best shoty of Keeley's marvellous mamaries yet! These days everything is about ROEI.<br> The xp site is very useful, it contains images which guides you through the principles. What's the attraction of motor racing anyway? Drinking alcohol is also detrimental for people with diabetes because it can worsen neuropathy and increase the burning, tingling and numb sensations that are experienced.<br> to generate findings that are informative for decision makers," said Dr. When consumers click on the "order now", button, a list of tips on how to spot Internet scams pops up instead. Selling To Local ShopsSelling to stores nearby can be a good way to get started selling wholesale. uk if you think you will make the gradeboobies. I feel you shouldn't try to stick to one methodology, but try and take some from the several methodologies and use what works best for you and the project you're dealing with. jpg Viewed: 3917 times.<br> Normally an IfElse activity will work based on a Code condition which is specified with code on the workflow.<br> Worth the trip to Birmingham baby!<br> I feel you shouldn't try to stick to one methodology, but try and take some from the several methodologies and use what works best for you and the project you're dealing with.<br> Kevin Waterhouse, R-Windham, said he was inspired by a group of homeschoolers studying ecology.<br> I can't remember the last time that I went into a requirements meeting where we discussed a proposed solution, where there were no integration with existing systems.<br> </body> </html> |
From: Henning v. B. <H.v...@t-...> - 2006-12-07 17:35:32
|
Peter Masiar asked: > ... > SQL statement: SELECT x neuron FROM TABLE(SDO_RDF_MATCH( '(?x r:type c:neuron)', SDO_RDF_Models('senselab3'), SDO_RDF_Rulebases('RDFS','senselab3_rb'), SDO_RDF_Aliases(SDO_RDF_Alias('c','http://senselab.med.yale.edu/class#') , SDO_RDF_Alias('i','http://senselab.med.yale.edu/instance#'), SDO_RDF_Alias('r','http://www.w3.org/1999/02/22-rdf-syntax-ns#') ), null)); > ... > DatabaseError: ORA-00911: invalid character Peter, you should not use the semicolon, it is not part of SQL, but rather it is used in SQL*Plus and PL/SQL to delimit statement. Try without it. HtH Henning |
From: Henning v. B. <H.v...@t-...> - 2006-12-07 08:30:47
|
Hi Mark, pls try the following script: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #!/bin/env python # -*- coding: iso-8859-1 -*- # import cx_Oracle # Sample 1 def doAllCurs (curs, stmt, **args): rset =3D curs.execute (stmt, **args) for rec in curs: yield rec return # Sample 2 def doAllConn (conn, stmt, **args): curs =3D conn.cursor() for rec in doAllCurs(curs, stmt, **args): yield rec curs.close() return # Print All Records # This could perhaps be recoded in a more functional programming style def printAll (curs, stmt, **args): for rec in doAllCurs(curs, stmt, **args): print rec def test (uid, query, **bindvars): conn =3D cx_Oracle.connect(uid) curs =3D conn.cursor() printAll (curs, query, **bindvars) =20 print "" print "The first 20 records as a list:" print list (doAllCurs (curs, query, **bindvars))[:20] =20 curs.close() conn.close() # Test me if __name__ =3D=3D "__main__": import sys if len(sys.argv) > 1: uid =3D sys.argv[1] conditions =3D dict ([tuple(arg.split("=3D",1)) for arg in sys.argv[2:] ]) query =3D """ select object_name , object_type from user_objects where 1=3D1""" for nam,val in conditions.items(): query +=3D ("\n and %s =3D :%s" % (nam,nam)) print "Query:" print query print "*" * 70 print "Bind Vars:" for nam,val in conditions.items(): print "%-20s =3D %r" % (nam,val) print "*" * 70 test (uid, query, **conditions); else: print "Test me like this:" print "%s uid/pwd@dbs object_type=3DTABLE" % sys.argv[0] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Just save it as test.py, then call it like test.py userid/password@database object_type=3DTABLE or, with other condiditons: test.py userid/password@database object_type=3DTABLE object_name=3DXYZ (This will probably not return any results) HTH Henning |
From: Mark H. <mh...@pi...> - 2006-12-06 08:23:55
|
Is it possible to do if there is a keyword argument? I want to wrap queries like this: curs.execute('select * from p4_files where p4path like :x', x=NAME) print curs.fetchall() in a function like this: def doall(*cmd): curs.execute(cmd) return curs.fetchall() r=doall('select * from p4_files where p4path like :x', x=NAME) Any clues appreciated! Mark -- Mark Harrison Pixar Animation Studios |
From: Frank v. L. <fvl...@ca...> - 2006-12-05 08:14:33
|
We had to deal with a similar problem of loosing a connection. What we do is to store a queue of all queries (updates,inserts, and deletes) made during a transaction. If for some reason the connection is lost before a commit we re connect and execute the queries again in the same order. After a commit we empty the queue for that transaction. This has worked quite well. I must add that we seldom drop a connection. We try to keep transactions and connection time short, but we do not have thousands of transactions a minute. In the past we also used a connection cache. So we have long running open connections that are more likely to disconnect once in a while, in combination with the query queuing. This made the system more responsive when we deal with many transactions as connecting every time gives some overhead. To minimize unexpected connection losses we refreshed the connection once in a while. Frank. Anthony Tuininga wrote: > No, there is no way to globally catch a disconnection. The first time > you will be aware of it is when you make a query and the exception > "not connected to database" (or something similar) is raised. A number > of people perform a "ping" first (execute the statement "select 1 from > dual") before attempting their own query. If that query fails, they > estabilish a new connection and use that instead. I'm not aware of any > other techniques so if anyone else has any to share, please do so. > > On 12/4/06, Mark Harrison <mh...@pi...> wrote: >> Here's kind of a general connection question. >> >> I've got an application server (xml-rpc based) with >> a long-lived persistent connection. >> >> Of course, the appserver needs to handle the eventuality >> that the connection will be closed at some time. >> >> What's the best way to handle this? Is there some nice >> way to globally catch a disconnection and automatically >> reconnect, or some such? >> >> Many TIA! >> Mark >> >> -- >> Mark Harrison >> Pixar Animation Studios >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share your >> opinions on IT & business topics through brief surveys - and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- -------------------------------------- Frank van Lingen California Institute of Technology CA 91125 Pasadena United States -------------------------------------- Mail Code:356-48 bld :340 Lauritsen email :fvl...@ca... im(aim) :marcellus0872 tel :(+1) 626 395 3862 url :http://www.vanlingen.name/ -------------------------------------- |
From: Anthony T. <ant...@gm...> - 2006-12-04 17:16:22
|
On 12/4/06, Laurelin of Middle Earth <la...@fn...> wrote: > I had earlier requested a "reconnect" method on the connection itself, > so that the class instance could transparently "get a new *physical* > connection under the covers". I received the following response > from Anthony Tuininga: > > "I'll look into adding this at some point -- > assuming there are no hidden gotchas that make it undesirable, of > course. If I run into any of those I'll let you know." > > (quoted from private mail send on 5-Oct-2006). I haven't heard that > the changes have been put into the code -- but I haven't heard of any > hidden gotchas either, so... Still haven't gotten around to doing this, yet. I'd be interested in the code used by the previous poster as it might point to a simple solution or some hidden gotchas that would need to be documented at least. > -- lauri > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Laurelin of M. E. <la...@fn...> - 2006-12-04 17:02:58
|
I had earlier requested a "reconnect" method on the connection itself, so that the class instance could transparently "get a new *physical* connection under the covers". I received the following response from Anthony Tuininga: "I'll look into adding this at some point -- assuming there are no hidden gotchas that make it undesirable, of course. If I run into any of those I'll let you know." (quoted from private mail send on 5-Oct-2006). I haven't heard that the changes have been put into the code -- but I haven't heard of any hidden gotchas either, so... -- lauri |