From peter.bittner@gmx.net Tue Jan 2 12:05:35 2001 From: peter.bittner@gmx.net (peter.bittner@gmx.net) Date: Tue, 2 Jan 2001 13:05:35 +0100 (MET) Subject: [DB-SIG] Python as Apache-module Message-ID: <15017.978437135@www32.gmx.net> Hi there! (I hope this is not off-topic here, but since Apache and MySQL is a common combination I hope I'm not wrong here!) I have learned Python a year ago, I used it for CGI to write a web-based library database, and I have become a real fan. I like Python a lot, but there is one thing I dislike which is its performance as far as its usage for the Web is concerned. - Compared to sites that run PHP my locally(!) running web-interface was dead slow. Since my brother thinks :) he likes PHP, I've looked into it as well, and I have found out why PHP is much faster on a Web-page than Python would be: PHP is available as an Apache module, and a module in Apache runs much faster than any CGI-programs!! So, now it's already a couple of days that I'm thinking about whether Python could be made available as Apache module as well. So I could stay with Python AND Python might be more attractive for Web-programmers in general! :-D Does anybody know anything about that? Are there plans to offer Python as an Apache module? (Maybe Apache would include this module in its standard distribution!!) Cheers, Peter -- Peter Bittner web: http://beam.to/peter.bittner mail: peter.bittner@gmx.net mobile: +43/(0)650/8901150 +----------------------------- | HTML-Minikurs: http://beam.to/htmlkurs | Gesundheit: http://www.gesundheitsfoerderung.at | Fasten: http://www.gesundheitsfoerderung.at/fasten Sent through GMX FreeMail - http://www.gmx.net From mal@lemburg.com Tue Jan 2 12:13:13 2001 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 02 Jan 2001 13:13:13 +0100 Subject: [DB-SIG] Python as Apache-module References: <15017.978437135@www32.gmx.net> Message-ID: <3A51C5D9.52A22C32@lemburg.com> peter.bittner@gmx.net wrote: > > Hi there! > > (I hope this is not off-topic here, but since Apache and MySQL is a common > combination I hope I'm not wrong here!) This SIG is about Python and databases, so this post is not really on topic... > I have learned Python a year ago, I used it for CGI to write a web-based > library database, and I have become a real fan. > I like Python a lot, but there is one thing I dislike which is its > performance as far as its usage for the Web is concerned. - Compared to sites that > run PHP my locally(!) running web-interface was dead slow. > > Since my brother thinks :) he likes PHP, I've looked into it as well, and > I have found out why PHP is much faster on a Web-page than Python would be: > PHP is available as an Apache module, and a module in Apache runs much > faster than any CGI-programs!! > > So, now it's already a couple of days that I'm thinking about whether > Python could be made available as Apache module as well. So I could stay with > Python AND Python might be more attractive for Web-programmers in general! > :-D > > Does anybody know anything about that? > Are there plans to offer Python as an Apache module? > (Maybe Apache would include this module in its standard distribution!!) Here are two links which should help you: http://www.python.org/topics/web/ http://www.vex.net/parnassus/apyllo.py/812237977.116898894 There are at least three Apache modules which try to bind Python to Apache: mod_python, ModSnake, PyApache. Don't know much about their status though. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From gstein@lyra.org Tue Jan 2 12:40:18 2001 From: gstein@lyra.org (Greg Stein) Date: Tue, 2 Jan 2001 04:40:18 -0800 Subject: [DB-SIG] Python as Apache-module In-Reply-To: <3A51C5D9.52A22C32@lemburg.com>; from mal@lemburg.com on Tue, Jan 02, 2001 at 01:13:13PM +0100 References: <15017.978437135@www32.gmx.net> <3A51C5D9.52A22C32@lemburg.com> Message-ID: <20010102044018.D10567@lyra.org> On Tue, Jan 02, 2001 at 01:13:13PM +0100, M.-A. Lemburg wrote: >... > There are at least three Apache modules which try to bind Python > to Apache: mod_python, ModSnake, PyApache. Don't know much about > their status though. PyApache is a CGI accelerator. If you have existing CGIs, then it can be nice. However, I'm not sure about the status of it, whether it is being maintained, etc. mod_snake and mod_python both have CGI accelerators. But they also allow you to write much higher performance Python code. They have slightly different approaches and different feature sets. mod_snake is a new, clean implementation and works with Apache 1.3 and 2.0. mod_python is a bit older, but I think it carries a bit of baggage as a result. http://modsnake.sourceforge.net/ http://www.modpython.org/ Cheers, -g -- Greg Stein, http://www.lyra.org/ From Mike.Olson@fourthought.com Wed Jan 3 17:03:17 2001 From: Mike.Olson@fourthought.com (Mike Olson) Date: Wed, 03 Jan 2001 10:03:17 -0700 Subject: [DB-SIG] Python as Apache-module References: <15017.978437135@www32.gmx.net> <3A51C5D9.52A22C32@lemburg.com> <20010102044018.D10567@lyra.org> Message-ID: <3A535B55.6C757F83@FourThought.com> Greg Stein wrote: > > > mod_snake and mod_python both have CGI accelerators. But they also allow you > to write much higher performance Python code. They have slightly different > approaches and different feature sets. mod_snake is a new, clean > implementation and works with Apache 1.3 and 2.0. mod_python is a bit older, > but I think it carries a bit of baggage as a result. > > http://modsnake.sourceforge.net/ > http://www.modpython.org/ Just a note, we use ModSnake quite often and have had very few problems with it. The largest have been getting it all compilied with apache. Once that was done it seems stable (we run 4Suite.org with ModSnake) Mike > > Cheers, > -g > > -- > Greg Stein, http://www.lyra.org/ > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://www.python.org/mailman/listinfo/db-sig -- Mike Olson Principal Consultant mike.olson@fourthought.com (303)583-9900 x 102 Fourthought, Inc. http://Fourthought.com Software-engineering, knowledge-management, XML, CORBA, Linux, Python From Darek.Kedra@vai.org Fri Jan 5 18:05:57 2001 From: Darek.Kedra@vai.org (Kedra, Darek) Date: Fri, 5 Jan 2001 13:05:57 -0500 Subject: [DB-SIG] MySQLdb @Tru64 -> MySQL @Linux Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C07742.27648427 Content-Type: text/plain Dear All, I am trying to use Python (Python 2.0 #1[C] on osf1V5) to collect some data on Alpha (Tru64 v5.0), then feed it to the MySQL database (3.23.29a-gamma) running on Linux box (Mandrake 7.1). My problem is to get a working MySQLdb module (or anything similar) on Alpha. MySQLdb requires installation of MySQL on Alpha. Getting MySQL to compile on Tru64 is painful to put it mildly (latest gcc or Compaq C++ is needed). Before I will go this route I would like to get some more information. 1. Is there anybody using this setup? (see Subject) 2. If yes, I will appreciate info about versions of MySQL, gcc or Compaq C++, switches for configure etc... 3. any shortcuts? (i.e. compiling not the whole MySQL server but just client libraries) 4. other solutions? I will very much appreciate your help. Greetings Darek ------_=_NextPart_001_01C07742.27648427 Content-Type: text/html Content-Transfer-Encoding: quoted-printable MySQLdb @Tru64 -> MySQL @Linux

Dear All,
 
 I am trying to use Python (Python 2.0 #1[C] on = osf1V5) to collect some data on Alpha (Tru64 v5.0), then feed it to the = MySQL database (3.23.29a-gamma) running on Linux box (Mandrake = 7.1).

 
My problem is to get a working MySQLdb module (or = anything similar) on Alpha. MySQLdb requires
 installation of MySQL on Alpha. Getting MySQL = to compile on Tru64 is painful to put it mildly (latest gcc or Compaq = C++ is needed). Before I will go this route I would like to get some = more information.

 
 1. Is there anybody using this setup? (see = Subject)
 
 2. If yes, I will appreciate info about = versions of MySQL, gcc or Compaq C++, switches for configure = etc...
 
 3. any shortcuts? (i.e. compiling not the = whole MySQL server but just client libraries)
 
 4. other solutions?
 
 I will very much appreciate your help.
 
 Greetings
 
 Darek

------_=_NextPart_001_01C07742.27648427-- From Cary Collett Fri Jan 5 19:20:11 2001 From: Cary Collett (Cary Collett) Date: Fri, 5 Jan 2001 14:20:11 -0500 Subject: [DB-SIG] MySQLdb @Tru64 -> MySQL @Linux In-Reply-To: ; from Darek.Kedra@vai.org on Fri, Jan 05, 2001 at 01:05:57PM -0500 References: Message-ID: <20010105142011.E4234@ratatosk.org> You can feed MySQL's configure --without-server to only compile the client. This should make things alot easier I'd think. Also, hop on the MySQL mailing list long enough to send this message there too. Most replies will get sent to you as well as the list so you can hop back off this high traffic list right away if you don't want to deal with the message volume. Also, you can monitor the archives. Unfortunately I don't have much experience compiling stuff on Tru64 so I can't offer any other advice. Good luck! Cary Thus spake Kedra, Darek (Darek.Kedra@vai.org): > Dear All, > > I am trying to use Python (Python 2.0 #1[C] on osf1V5) to collect some data > on Alpha (Tru64 v5.0), then feed it to the MySQL database (3.23.29a-gamma) > running on Linux box (Mandrake 7.1). > > My problem is to get a working MySQLdb module (or anything similar) on > Alpha. MySQLdb requires > installation of MySQL on Alpha. Getting MySQL to compile on Tru64 is > painful to put it mildly (latest gcc or Compaq C++ is needed). Before I will > go this route I would like to get some more information. > > 1. Is there anybody using this setup? (see Subject) > > 2. If yes, I will appreciate info about versions of MySQL, gcc or Compaq > C++, switches for configure etc... > > 3. any shortcuts? (i.e. compiling not the whole MySQL server but just > client libraries) > > 4. other solutions? > > I will very much appreciate your help. > > Greetings > > Darek -- Cary Collett cary@ratatosk.org http://cary.ratatosk.org/ "To me boxing is like ballet, except that there's no music, no choreography, and the dancers hit eachother." -- Jack Handy From chris@cogdon.org Mon Jan 15 23:37:18 2001 From: chris@cogdon.org (Chris Cogdon) Date: Mon, 15 Jan 2001 15:37:18 -0800 (PST) Subject: [DB-SIG] PostgreSQL modules? Message-ID: Hi there. I'm a little confused as to which module to use to talk to a PostgreSQL database from python. I've found two modules, and am wondering what people out there are generally using. PyGreSQL-3.1: Seems to be actively maintained. I've been using the non-API interface for some time, now, but the DB-API-2.0 compliant module isn't; it doesnt do quoting of parameters. PySQL-1.0: Seems to work okay, but the project on sourceforge looks completely dead. Is this still actively maintained ? Any advice greatly appreciated. ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From uche.ogbuji@fourthought.com Tue Jan 16 14:33:48 2001 From: uche.ogbuji@fourthought.com (uche.ogbuji@fourthought.com) Date: Tue, 16 Jan 2001 07:33:48 -0700 Subject: [DB-SIG] ANN: 4Suite 0.10.1 Message-ID: <200101161433.HAA25241@localhost.localdomain> Fourthought, Inc. (http://Fourthought.com) announces the release of 4Suite 0.10.1 --------------------------- Open source tools for standards-based XML, DOM, XPath, XSLT, RDF XPointer, XLink and object-database development in Python http://4Suite.org 4Suite is a collection of Python tools for XML processing and object database management. An integrated packaging of several formerly separately-distributed components: 4DOM, 4XPath and 4XSLT, 4RDF, 4ODS, 4XPointer, 4XLink and DbDOM. News ---- * PyXML (0.6.3 + fixes) is now built in * Implement XInclude * DbDom: Implement cloneNode and document fragments * XSLT: More thorough test harness * XSLT: Support source docs from stdin on 4xslt command line * XSLT: Implement unparsed-entity-uri * XSLT: Restricted HTML writer output allowed as security tool * XPath: Add extension funcs: evaluate,distinct,split,range,if,find * DOM: Update to 2000-11-13 level 2 recomendation * DOM: Proper SAX2 support for reader * DOM: Add native sgmlop reader * RDF: Add removeAll to Model * Documentation updates and consolidation * Domlette reader option to force 8-bit DOM strings even in Python 2.0 * Organize Reader and URI handler APIs to allow easier customizations * Many Python 1.5.2 and 2.0 compatibility fixes * Many misc optimizations * Many misc bug-fixes * 4Suite.org revamped: much heavier use of 4Suite Server features More info and Obtaining 4Suite ------------------------------ Please see http://4Suite.org >From where you can download source, Windows and Linux binaries. 4Suite is distributed under a license similar to that of the Apache Web Server. -- Uche Ogbuji Principal Consultant uche.ogbuji@fourthought.com +01 303 583 9900 x 101 Fourthought, Inc. http://Fourthought.com 4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA Software-engineering, knowledge-management, XML, CORBA, Linux, Python From ttaavi@neti.ee Tue Jan 16 19:09:23 2001 From: ttaavi@neti.ee (Taavi Tiirik) Date: Tue, 16 Jan 2001 21:09:23 +0200 Subject: [DB-SIG] DCOracle with win32 In-Reply-To: <20010116181500.8D3F9E72D@mail.python.org> Message-ID: Dear all, Could somebody please assist me with compiling DCOracle under win32. regards, Taavi From rcena@epcor-group.com Wed Jan 17 20:48:36 2001 From: rcena@epcor-group.com (Cena, Resty) Date: Wed, 17 Jan 2001 13:48:36 -0700 Subject: [DB-SIG] DCOracle with win32 Message-ID: >> Could somebody please assist me with compiling DCOracle under win32. Me, too, please. I've been trying to but have not had much success. Better yet, how about an installable binary file (of DCOracle in Win32). Thanks much! Resty > -----Original Message----- > From: Taavi Tiirik [SMTP:ttaavi@neti.ee] > Sent: Tuesday, January 16, 2001 12:09 PM > To: db-sig@python.org > Subject: [DB-SIG] DCOracle with win32 > > Dear all, > > Could somebody please assist me with compiling DCOracle > under win32. > > regards, > Taavi > > > > From ttaavi@neti.ee Thu Jan 18 20:12:32 2001 From: ttaavi@neti.ee (Taavi Tiirik) Date: Thu, 18 Jan 2001 22:12:32 +0200 Subject: [DB-SIG] DCOracle and unicode strings In-Reply-To: Message-ID: Dear all, Does anybody use python + dcoracle to bind python unicode strings to oracle datatypes like NCHAR and NVARCHAR2 (NLS_NCHAR set to UTF8)? And if I can't get binding work right now can anybody suggest a quick hack around? :-) thank you in advance, Taavi From ryanw@inktomi.com Thu Jan 18 22:16:56 2001 From: ryanw@inktomi.com (Ryan Weisenberger) Date: Thu, 18 Jan 2001 14:16:56 -0800 Subject: [DB-SIG] DCOracle with win32 In-Reply-To: <20010118170125.47C65F656@mail.python.org> Message-ID: <4.3.2.7.2.20010118140411.00e10230@inkt-3.inktomi.com> I recently compiled DCOracle on NT using Microsoft Visual C++ 6.0 and the Oracle8i personal edition. You need to compile two files into DLLs: Buffer.c and oci_.c Create a new project to create a Win32 Dynamic Link Library. Add Buffer.c as a source file. You may need to play with the paths to make sure the compiler finds Buffer.h. Under Settings/C++/Preprocessor/Additional Include Directories add the Python "include" directory and the "[ORACLE_HOME]\oci\include" directory. Under Settings/Link/Object/Library Modules, you need to add the Python library "python[ver#].lib" and "oci.lib" found in [ORACLE_HOME]\oci\lib\msvc\oci.lib Finally, you need to make a small change to the source code. In Buffer.c, look for: void initBuffer() and change it to: void __declspec(dllexport) initBuffer() It should now compile, and you'll get a file called Buffer.dll. Repeat these steps exactly for oci_.c to get oci_.dll. Now take both of these DLLs and put them in the DCOracle directory that comes in the DCOracle tarball. Move that directory into the Lib directory for Python, and then you should be able to use the module with the command: import DCOracle I hope this helps! - Ryan > >> Could somebody please assist me with compiling DCOracle >under win32. > >Me, too, please. I've been trying to but have not had much success. Better >yet, how about an installable binary file (of DCOracle in Win32). >Thanks much! >Resty > > > -----Original Message----- > > From: Taavi Tiirik [SMTP:ttaavi@neti.ee] > > Sent: Tuesday, January 16, 2001 12:09 PM > > To: db-sig@python.org > > Subject: [DB-SIG] DCOracle with win32 > > > > Dear all, > > > > Could somebody please assist me with compiling DCOracle > > under win32. > > > > regards, > > Taavi > > > > > > > > From bangmin@NOTENHILL.com Mon Jan 22 00:33:00 2001 From: bangmin@NOTENHILL.com (=?euc-kr?B?uea5zg==?=) Date: Mon, 22 Jan 2001 09:33:00 +0900 Subject: [DB-SIG] Transaction with DCOracle? Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0840A.DFDC3500 Content-Type: text/plain; charset="KS_C_5601-1987" Dear python geeks.. ----------------------------------------------------------- import DCOracle csor = DCOracle.Connect('...') try: csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') csor.commit() print 'commit' except Exception: csor.rollback() print 'rollback' csor.close() ----------------------------------------------------------- I've tried to handle Exceptions to get transaction like that, but I couldn't roll back the sqls. you know, if the first column in HISTORY table is a primary key, the 2nd row couldn't be inserted. and then i hope python throws exception, rolls back so the 1st row is not inserted. here's the error msg. -------------------------------------------------------------------- Traceback (innermost last): File "test.py", line 9, in ? csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 299, in execute r = self._execute(params__, kw) File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 260, in _execute if rc!=3129: self._error() File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 109, in _error raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc)) oci.error: (1, 'ORA-00001: unique constraint (POINT.PK_PN_HISTORY) violated') -------------------------------------------------------------------- do i have to handle another exception? thank you in advance. Min. ------_=_NextPart_001_01C0840A.DFDC3500 Content-Type: text/html; charset="KS_C_5601-1987" Content-Transfer-Encoding: quoted-printable
Dear python geeks..=20
 
---------------------------------------------= --------------
import DCOracle =
csor =3D=20 DCOracle.Connect('...')
try: =
    csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)')=20
     =
    csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)')=20

    csor.commit() =
    print=20 'commit'
except Exception:=20
    csor.rollback() =
    print=20 'rollback'
csor.close()=20
----------------------------------------------------------- 
I've tried to=20 handle Exceptions to get transaction like = that,
but I couldn't=20 roll back the sqls.
 
you know, if the=20 first column in HISTORY table is a primary = key,
the 2nd=20 row couldn't be inserted.
 
and then i hope=20 python throws exception, rolls back so
the 1st=20 row is not inserted.
 
here's the error=20 msg.
 
---------------------------------------------= -----------------------
Traceback=20 (innermost last):
  File "test.py", line 9, in=20 ?
    csor.execute('INSERT
 INTO history VALUES(\'20010114\',=20 123123)') 
  File = "/usr/lib/python1.5/DCOracle/ociCurs.py",=20 line 299, in execute
    r =3D = self._execute(params__,=20 kw)
  File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 260, = in=20 _execute
    if rc!=3D3129: self._error()
  = File=20 "/usr/lib/python1.5/DCOracle/ociCurs.py", line 109, in=20 _error
    raise error, (rc,=20 oci_.OracleErrorMessage(self._c.lda, rc))
oci.error: (1, 'ORA-00001: = unique=20 constraint (POINT.PK_PN_HISTORY) violated')
---------------------------------------------= -----------------------
 
do i have to handle another=20 exception?
 
thank you in=20 advance.
 
Min.
= ------_=_NextPart_001_01C0840A.DFDC3500-- From chris@onca.catsden.net Mon Jan 22 00:32:56 2001 From: chris@onca.catsden.net (chris@onca.catsden.net) Date: Sun, 21 Jan 2001 16:32:56 -0800 (PST) Subject: [DB-SIG] Transaction with DCOracle? In-Reply-To: Message-ID: On Mon, 22 Jan 2001, [euc-kr] ¹æ¹Î wrote: > Dear python geeks.. > > ----------------------------------------------------------- > import DCOracle > csor = DCOracle.Connect('...') > try: > csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') > > csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') > > csor.commit() > print 'commit' > except Exception: > csor.rollback() > print 'rollback' > csor.close() > ----------------------------------------------------------- > > I've tried to handle Exceptions to get transaction like that, > but I couldn't roll back the sqls. > > you know, if the first column in HISTORY table is a primary key, > the 2nd row couldn't be inserted. > > and then i hope python throws exception, rolls back so > the 1st row is not inserted. > > here's the error msg. > > -------------------------------------------------------------------- > Traceback (innermost last): > File "test.py", line 9, in ? > csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') > File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 299, in execute > r = self._execute(params__, kw) > File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 260, in _execute > if rc!=3129: self._error() > File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 109, in _error > raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc)) > oci.error: (1, 'ORA-00001: unique constraint (POINT.PK_PN_HISTORY) > violated') > -------------------------------------------------------------------- > > do i have to handle another exception? Without going through the library myself (dont use Oracle myself), I'd have to guess that oci.error is not a descendant of Exception. (Bad library writer, Bad! :) Try changing it to "except oci.error:" or just plain "except:" ("`-/")_.-'"``-._ Ch'marr, a.k.a. . . `; -._ )-;-,_`) Chris Cogdon (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' FC1.3: FFH3cmA+>++C++D++H++M++P++R++T+++WZ++Sm++ ((,.-' ((,/ fL RLCT acl+++d++e+f+++h++i++++jp-sm++ From sabaini@niil.at Mon Jan 22 17:37:35 2001 From: sabaini@niil.at (Peter Sabaini) Date: Mon, 22 Jan 2001 18:37:35 +0100 (CET) Subject: [DB-SIG] Transaction with DCOracle? In-Reply-To: Message-ID: i do something like ---------------- from DCOracle import Connect, error try: cursor.somedangerous_sql() except error, detail: cursor.rollback() ---------------- hth peter. On Mon, 22 Jan 2001, [euc-kr] ¹æ¹Î wrote: :Dear python geeks.. : :----------------------------------------------------------- :import DCOracle :csor = DCOracle.Connect('...') :try: : csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') : : csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') : : csor.commit() : print 'commit' :except Exception: : csor.rollback() : print 'rollback' :csor.close() :----------------------------------------------------------- : :I've tried to handle Exceptions to get transaction like that, :but I couldn't roll back the sqls. : :you know, if the first column in HISTORY table is a primary key, :the 2nd row couldn't be inserted. : :and then i hope python throws exception, rolls back so :the 1st row is not inserted. : :here's the error msg. : :-------------------------------------------------------------------- :Traceback (innermost last): : File "test.py", line 9, in ? : csor.execute('INSERT INTO history VALUES(\'20010114\', 123123)') : File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 299, in execute : r = self._execute(params__, kw) : File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 260, in _execute : if rc!=3129: self._error() : File "/usr/lib/python1.5/DCOracle/ociCurs.py", line 109, in _error : raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc)) :oci.error: (1, 'ORA-00001: unique constraint (POINT.PK_PN_HISTORY) :violated') :-------------------------------------------------------------------- : :do i have to handle another exception? : :thank you in advance. : :Min. : -- _________________________________________________ peter sabaini, mailto: sabaini@niil.at ------------------------------------------------- From mal@lemburg.com Mon Jan 22 18:28:48 2001 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 22 Jan 2001 19:28:48 +0100 Subject: [DB-SIG] Transaction with DCOracle? References: Message-ID: <3A6C7BE0.54933619@lemburg.com> Peter Sabaini wrote: > > i do something like > > ---------------- > from DCOracle import Connect, error > try: cursor.somedangerous_sql() > except error, detail: cursor.rollback() > ---------------- A general warning on this kind of approach: not all SQL commands can be rolled back, e.g. dropping a table is not necessarily reversable... -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From andy@dustman.net Mon Jan 22 19:46:08 2001 From: andy@dustman.net (Andy Dustman) Date: Mon, 22 Jan 2001 14:46:08 -0500 (EST) Subject: [DB-SIG] MySQLdb module 0.3.1 Message-ID: An interface to MySQL Stability: Perfect in every way Released: 2001-01-22 00:00 UTC Notes This release fixes two minor issues with 0.3.0. If they don't otherwise affect you, you don't need to upgrade. This is a release candidate for version 1.0.0. The plan is that 1.0.x will be the last version to support Python-1.5.2 and MySQL-3.22. Version 1.1.x will target MySQL-3.23, the upcoming MySQL-4.0, and Python-2.x. MySQL INTEGER columns have a FIELD_TYPE of LONG, which is a C long and therefore a Python integer. However, INTEGER UNSIGNED may overflow when converted to a Python integer. Therefore, FIELD_TYPE.LONG is now converted to a Python long integer. To revert to the old behavior: import MySQLdb MySQLdb.type_conv[MySQLdb.FIELD_TYPE.LONG]=int MySQL-3.23.29a broke the version parsing. Don't use 3.23.29a. At the time of writing, 3.23.32 (stable) is the current version. MySQLdb now looks for the server variable have_bdb (YES) to determine whether or not transactions can be performed. You need at least MySQL-3.23.30 for this. Documentation has been brought up-to-date. Note that all Linux binaries here are compiled with Python-1.5.2, MySQL-3.23.32, Red Hat 6.2, and RPM 4.0 (where applicable). Windows binaries may show up at http://highqualdev.com http://dustman.net/andy/python/MySQLdb/0.3.1 -- Andy Dustman PGP: 0xC72F3F1D @ .net http://dustman.net/andy "Normally with carbonara you use eggs, but I used lobster brains instead." -- Masahiko Kobe (Iron Chef Italian): 30-year-old Giant Lobster Battle From gerhard.nospam@bigfoot.de Wed Jan 24 04:10:13 2001 From: gerhard.nospam@bigfoot.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 24 Jan 2001 05:10:13 +0100 Subject: [DB-SIG] [ANN] PyGreSQL win32 binaries available Message-ID: <3A6E55A5.7610DB3D@bigfoot.de> Finally I have managed to build PyGreSQL v3.1 for Windows. A full distribution (binary + patched source) is available at http://highqualdev.com. This is for Python 2.0. I have sent the relevant patches to the maintainer, so hopefully they will show up in a future version of PyGreSQL. Installing the distribution should be as easy as issuing python setup.py install on a command prompt. This is the first release, so I'd welcome any feedback on how well it works for you. Gerhard PS: Btw, I have updated the MySQLdb win32 dist. to version 0.3.1. -- Sorry for the fake email, please use the real one below to reply. contact: g e r h a r d @ b i g f o o t . d e web: http://highqualdev.com From astreib230@yahoo.com Thu Jan 25 04:37:06 2001 From: astreib230@yahoo.com (Allan Streib) Date: Wed, 24 Jan 2001 20:37:06 -0800 (PST) Subject: [DB-SIG] (no subject) Message-ID: <20010125043706.12245.qmail@web11704.mail.yahoo.com> Hi, I'm looking at having to do some script development in the near future which will require dealing with CLOBs columns (containing XML) in an Oracle database. My languages choices are Python or Perl. I don't know either one at this point, but that's not my concern. >From what I've seen,I think I would prefer Python as it it seems cleaner, less cryptic and easier to learn than Perl. However, what I read in the DCOracle.txt file concerns me a little; I'm hoping for some clarification. I will be calling Oracle stored procedures to get the XML-containing CLOB columns. I read that "Input/output arguments do not support long and long raw, date, and rowid variables" But elsewhere it appears that they can be handled using a Buffer. Can anyone clarify this for me, and does it make a difference if the CLOB is returned as an IN OUT argument as opposed to a cursor argument which contains the CLOB column? Also do you know if Oraperl has the same or a similar issue? Thanks. __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/ From astreib230@yahoo.com Thu Jan 25 05:07:51 2001 From: astreib230@yahoo.com (Allan Streib) Date: Wed, 24 Jan 2001 21:07:51 -0800 (PST) Subject: [DB-SIG] question on CLOBs in DCOracle Message-ID: <20010125050751.89597.qmail@web11703.mail.yahoo.com> (Sent this a minute ago without a subject; apologies if this is a duplicate.) Hi, I'm looking at having to do some script development in the near future which will require dealing with CLOBs columns (containing XML) in an Oracle database. My languages choices are Python or Perl. I don't know either one at this point, but that's not my concern. >From what I've seen,I think I would prefer Python as it it seems cleaner, less cryptic and easier to learn than Perl. However, what I read in the DCOracle.txt file concerns me a little; I'm hoping for some clarification. I will be calling Oracle stored procedures to get the XML-containing CLOB columns. I read that "Input/output arguments do not support long and long raw, date, and rowid variables" But elsewhere it appears that they can be handled using a Buffer. Can anyone clarify this for me, and does it make a difference if the CLOB is returned as an IN OUT argument as opposed to a cursor argument which contains the CLOB column? Also do you know if Oraperl has the same or a similar issue? Thanks. __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/ From ryanw@inktomi.com Thu Jan 25 18:17:32 2001 From: ryanw@inktomi.com (Ryan Weisenberger) Date: Thu, 25 Jan 2001 10:17:32 -0800 Subject: [DB-SIG] Problem with mxODBC Message-ID: <4.3.2.7.2.20010125095114.00afa640@inkt-3.inktomi.com> I'm CCing this to the db-sig mailing list in case anyone has any extra comments. There seems to be a problem with mxODBC when it tries to get large data types. In the following example, the data type is "image" under SQL Server 2000. This is a SQL_LONGVARBINARY with precision of 2147483647. The problem also occurs with "ntext", which is a SQL_WLONGVARCHAR. The mxODBCursor_GetData fails when the large data type is not the last column in the SELECT statement. So while this works: select categoryname, picture from categories this does not: select picture, categoryname from categories The second SELECT statement reports: '[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index' when it tries to fetch the first record. The work around seems to be to disable the GetData function for the specific datatype. So in mxODBCursor_AllocateOutputVars after: case SQL_LONGVARBINARY: I set vars[i].use_getdata to 0, and the data is returned fine. Is there a problem with this work around? I'm including my sample program, and the debug output from mxODBC. Thanks, Ryan import mxODBC db = mxODBC.Connect('sqlserver') c = db.cursor() c.execute('select categoryname, picture from categories') data = c.fetchone() c.execute('select picture, categoryname from categories') data = c.fetchone() db.close() Log: --- New Log Session --- Thu Jan 25 10:03:22 2001 Importing the mxDateTime C API... module found API object found API object initialized. sizeof(mxODBCursor_Variable)=76 mxODBC_New: server='sqlserver', uid='', passwd='', clearAC=1 mxODBC_New: created new connection at 0x7d2f40 mxODBCursor_New: created new cursor '' at 0x7d9fa0 mxODBCursor_Execute: preparing statement 'select categoryname, picture from categories' mxODBCursor_Execute: number of params in statement: 0 mxODBCursor_Execute: executing command without parameters mxODBCursor_FreeVars: called for cursor at 0x7d9fa0 mxODBCursor_PrepareOutput: colcount=2 rowcount=-1 mxODBCursor_PrepareOutput: column 0: name='categoryname' type=-9 precision=15 scale=0 nullable=0 mxODBCursor_PrepareOutput: column 1: name='picture' type=-4 precision=2147483647 scale=0 nullable=1 mxODBCursor_AllocateOutputVars: binding column 0 - sqltype=-9, ctype=1, free=1, maxlen=16 mxODBCursor_AllocateOutputVars: true len=16 mxODBCursor_AllocateOutputVars: binding column 1 - sqltype=-4, ctype=-2, free=1, maxlen=1024 mxODBCursor_Fetch: fetching 2 column(s). mxODBCursor_Fetch: column 0... mxODBCursor_Fetch: column 1... mxODBCursor_GetData: received 10746 (max. 1024) bytes, buf size = 1024, offset = 0, ctype = -2 mxODBCursor_GetData: received 9722 (max. 1024) bytes, buf size = 2048, offset = 1024, ctype = -2 mxODBCursor_GetData: received 8698 (max. 2048) bytes, buf size = 4096, offset = 2048, ctype = -2 mxODBCursor_GetData: received 6650 (max. 4096) bytes, buf size = 8192, offset = 4096, ctype = -2 mxODBCursor_GetData: received 2554 (max. 8192) bytes, buf size = 16384, offset = 8192, ctype = -2 mxODBCursor_Execute: preparing statement 'select picture, categoryname from categories' mxODBCursor_Execute: number of params in statement: 0 mxODBCursor_Execute: executing command without parameters mxODBCursor_FreeVars: called for cursor at 0x7d9fa0 mxODBCursor_FreeVars: freeing output variable for column 0 mxODBCursor_FreeVars: freeing output variable for column 1 mxODBCursor_FreeVars: freeing output variable array mxODBCursor_PrepareOutput: colcount=2 rowcount=-1 mxODBCursor_PrepareOutput: column 0: name='picture' type=-4 precision=2147483647 scale=0 nullable=1 mxODBCursor_PrepareOutput: column 1: name='categoryname' type=-9 precision=15 scale=0 nullable=0 mxODBCursor_AllocateOutputVars: binding column 0 - sqltype=-4, ctype=-2, free=1, maxlen=1024 mxODBCursor_AllocateOutputVars: binding column 1 - sqltype=-9, ctype=1, free=1, maxlen=16 mxODBCursor_AllocateOutputVars: true len=16 mxODBCursor_Fetch: fetching 2 column(s). mxODBCursor_Fetch: column 0... mxODBCursor_GetData: received -858993460 (max. 1024) bytes, buf size = 1024, offset = 0, ctype = -2 mxODBC_ReportError: sqlstate='S1002' code=0 text='[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index' lineno=2198 rc=-1 mxODBCursor_Free: called for cursor at 0x7d9fa0 mxODBCursor_FreeVars: called for cursor at 0x7d9fa0 mxODBCursor_FreeVars: freeing output variable for column 0 mxODBCursor_FreeVars: freeing output variable for column 1 mxODBCursor_FreeVars: freeing output variable array mxODBCursor_FreeParameters: called for cursor at 0x7d9fa0 mxODBCursor_Close: called for cursor at 0x7d9fa0 mxODBCursor_Close: stmt cancelled mxODBCursor_Close: stmt freed mxODBC_Free: called for connection at 0x7d2f40 mxODBC_Close: called for connection at 0x7d2f40, closed=0 mxODBC_Close: disconnect mxODBC_Close: disconnect failed; rolling back the transaction mxODBC_Rollback: Rolling back changes for connection at 0x7d2f40 mxODBC_Close: disconnect mxODBC_Close: free connection From mal@lemburg.com Thu Jan 25 18:57:43 2001 From: mal@lemburg.com (M.-A. Lemburg) Date: Thu, 25 Jan 2001 19:57:43 +0100 Subject: [DB-SIG] Re: Problem with mxODBC References: <4.3.2.7.2.20010125095114.00afa640@inkt-3.inktomi.com> Message-ID: <3A707727.763632BB@lemburg.com> Ryan Weisenberger wrote: > > I'm CCing this to the db-sig mailing list in case anyone has any extra > comments. > > There seems to be a problem with mxODBC when it tries to get large data > types. In the following example, the data type is "image" under SQL Server > 2000. This is a SQL_LONGVARBINARY with precision of 2147483647. The > problem also occurs with "ntext", which is a SQL_WLONGVARCHAR. > > The mxODBCursor_GetData fails when the large data type is not the last > column in the SELECT statement. So while this works: > select categoryname, picture from categories > this does not: > select picture, categoryname from categories > > The second SELECT statement reports: > '[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index' > when it tries to fetch the first record. > > The work around seems to be to disable the GetData function for the > specific datatype. So in mxODBCursor_AllocateOutputVars after: > case SQL_LONGVARBINARY: > I set vars[i].use_getdata to 0, and the data is returned fine. Are you sure ? The data will most likely be truncated... > Is there a problem with this work around? I'm including my sample program, > and the debug output from mxODBC. This is a known problem. It is not really related to mxODBC, but to the capabilities of the ODBC driver. Some drivers do not allow mixing the use of SQLGetData() and direct binding of a result column. I have only seen this happen with MS Access. The correct work-around for this is to fetch all columns after the first one which needs SQLGetData (in order to fetch large data chunks) using the same technique. The next mxODBC version will have do this automatically provided that the ODBC driver reveals this problem via the SQLGetInfo() call. In any case, blob type columns should always be placed at the end of the result set, since this doesn't trigger the problem and is more efficient. > Thanks, > Ryan > > import mxODBC > db = mxODBC.Connect('sqlserver') > c = db.cursor() > c.execute('select categoryname, picture from categories') > data = c.fetchone() > c.execute('select picture, categoryname from categories') > data = c.fetchone() > db.close() > > Log: > --- New Log Session --- Thu Jan 25 10:03:22 2001 > > Importing the mxDateTime C API... > module found > API object found > API object initialized. > sizeof(mxODBCursor_Variable)=76 > mxODBC_New: server='sqlserver', uid='', passwd='', clearAC=1 > mxODBC_New: created new connection at 0x7d2f40 > mxODBCursor_New: created new cursor '' at 0x7d9fa0 > mxODBCursor_Execute: preparing statement 'select categoryname, picture from > categories' > mxODBCursor_Execute: number of params in statement: 0 > mxODBCursor_Execute: executing command without parameters > mxODBCursor_FreeVars: called for cursor at 0x7d9fa0 > mxODBCursor_PrepareOutput: colcount=2 rowcount=-1 > mxODBCursor_PrepareOutput: column 0: name='categoryname' type=-9 > precision=15 scale=0 nullable=0 > mxODBCursor_PrepareOutput: column 1: name='picture' type=-4 > precision=2147483647 scale=0 nullable=1 > mxODBCursor_AllocateOutputVars: binding column 0 - sqltype=-9, ctype=1, > free=1, maxlen=16 > mxODBCursor_AllocateOutputVars: true len=16 > mxODBCursor_AllocateOutputVars: binding column 1 - sqltype=-4, ctype=-2, > free=1, maxlen=1024 > mxODBCursor_Fetch: fetching 2 column(s). > mxODBCursor_Fetch: column 0... > mxODBCursor_Fetch: column 1... > mxODBCursor_GetData: received 10746 (max. 1024) bytes, buf size = 1024, > offset = 0, ctype = -2 > mxODBCursor_GetData: received 9722 (max. 1024) bytes, buf size = 2048, > offset = 1024, ctype = -2 > mxODBCursor_GetData: received 8698 (max. 2048) bytes, buf size = 4096, > offset = 2048, ctype = -2 > mxODBCursor_GetData: received 6650 (max. 4096) bytes, buf size = 8192, > offset = 4096, ctype = -2 > mxODBCursor_GetData: received 2554 (max. 8192) bytes, buf size = 16384, > offset = 8192, ctype = -2 > mxODBCursor_Execute: preparing statement 'select picture, categoryname from > categories' > mxODBCursor_Execute: number of params in statement: 0 > mxODBCursor_Execute: executing command without parameters > mxODBCursor_FreeVars: called for cursor at 0x7d9fa0 > mxODBCursor_FreeVars: freeing output variable for column 0 > mxODBCursor_FreeVars: freeing output variable for column 1 > mxODBCursor_FreeVars: freeing output variable array > mxODBCursor_PrepareOutput: colcount=2 rowcount=-1 > mxODBCursor_PrepareOutput: column 0: name='picture' type=-4 > precision=2147483647 scale=0 nullable=1 > mxODBCursor_PrepareOutput: column 1: name='categoryname' type=-9 > precision=15 scale=0 nullable=0 > mxODBCursor_AllocateOutputVars: binding column 0 - sqltype=-4, ctype=-2, > free=1, maxlen=1024 > mxODBCursor_AllocateOutputVars: binding column 1 - sqltype=-9, ctype=1, > free=1, maxlen=16 > mxODBCursor_AllocateOutputVars: true len=16 > mxODBCursor_Fetch: fetching 2 column(s). > mxODBCursor_Fetch: column 0... > mxODBCursor_GetData: received -858993460 (max. 1024) bytes, buf size = > 1024, offset = 0, ctype = -2 > mxODBC_ReportError: sqlstate='S1002' code=0 text='[Microsoft][ODBC SQL > Server Driver]Invalid Descriptor Index' lineno=2198 rc=-1 > mxODBCursor_Free: called for cursor at 0x7d9fa0 > mxODBCursor_FreeVars: called for cursor at 0x7d9fa0 > mxODBCursor_FreeVars: freeing output variable for column 0 > mxODBCursor_FreeVars: freeing output variable for column 1 > mxODBCursor_FreeVars: freeing output variable array > mxODBCursor_FreeParameters: called for cursor at 0x7d9fa0 > mxODBCursor_Close: called for cursor at 0x7d9fa0 > mxODBCursor_Close: stmt cancelled > mxODBCursor_Close: stmt freed > mxODBC_Free: called for connection at 0x7d2f40 > mxODBC_Close: called for connection at 0x7d2f40, closed=0 > mxODBC_Close: disconnect > mxODBC_Close: disconnect failed; rolling back the transaction > mxODBC_Rollback: Rolling back changes for connection at 0x7d2f40 > mxODBC_Close: disconnect > mxODBC_Close: free connection -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/