From matt@zope.com Mon Dec 2 14:58:19 2002 From: matt@zope.com (Matthew T. Kromer) Date: Mon, 02 Dec 2002 09:58:19 -0500 Subject: [DB-SIG] Returning floats in DCOracle2 In-Reply-To: <1038578174.5061.31.camel@jno.glas.net> References: <3DE73A1C.5020901@UralskyGSM.com> <1038578174.5061.31.camel@jno.glas.net> Message-ID: <3DEB750B.2040203@zope.com> The problem may have to do with a mismatch between the C locale's=20 sscanf() function for parsing numbers, and Oracle's numeric formatting=20 environment setting. This might come from the difference between trying=20 to parse "0.5" using "," as the decimal separator or vice versa ("0,5"=20 with "."). The reason DCOracle2's C layer handles numbers as strings is old, and no=20 longer valid (it used to cause problems under Linux to initialize in=20 Object mode). At some point in time I'll rip out all of the string /=20 number conversion (which usses sscanf()) and replace it with various=20 OCINumber calls. Alternatively, there might be a compiler problem. I was unable to reproduce the problem myself. jno wrote: >could not reproduce: > >[jno@hypnos jno]$ python =20 >Python 2.1.3 (#2, Jul 24 2002, 11:13:04) [C] on hp-uxB >Type "copyright", "credits" or "license" for more information. > =20 > >>>>import DCOracle >>>>d =3D DCOracle.Connect('xxx/xxx@xxx') >>>>c =3D d.cursor() >>>>c.execute('select 0.5 from dual') >>>>r=3Dc.fetchall() >>>>c.close() >>>>print r >>>> =20 >>>> >[(0.5,)] > =20 > >[jno@hypnos jno]$ uname -a >HP-UX hypnos B.11.00 U 9000/800 654339382 unlimited-user license >[jno@hypnos jno]$=20 > >well, it is NOT DCO2, Py 2.2.2 and HP-UX 11.11 ;-) > >-jno > >=F7 =F0=D4=CE, 29.11.2002, =D7 12:57, Alexei Ustyuzhaninov =CE=C1=D0=C9=D3= =C1=CC: > =20 > >>Hi! >> >>I have ran into a silly problem with DCOracle2. It returns wrong float=20 >>numbers from SELECT statement. >> >>bash-2.04$ cat test.py >>import DCOracle2 >>db =3D DCOracle2.connect("x/y@z") >>c =3D db.cursor() >>c.execute("SELECT 0.5 FROM DUAL") >>print c.fetchone() >> >>bash-2.04$ python test.py >>[3.6097722056218853] >> >>Unfortunately 0.5 is somewhat different from 3.6097722056218853. >>The environment is: >>HP-UX 11.11 >>python 2.2.2 >>DCOracle2 1.2 >> >>Could somebody give me a tip on the problem please? >> >>--=20 >>Best regards, >>Alexei Ustyuzhaninov >> >> >>_______________________________________________ >>DB-SIG maillist - DB-SIG@python.org >>http://mail.python.org/mailman/listinfo/db-sig >> > > > =20 > --=20 Matt Kromer Zope Corporation http://www.zope.com/=20 From plusk@radford.edu Mon Dec 2 16:44:36 2002 From: plusk@radford.edu (Paul D. Lusk) Date: Mon, 2 Dec 2002 16:44:36 +0000 (UTC) Subject: [DB-SIG] Re: Returning floats in DCOracle2 References: <3DE73A1C.5020901@UralskyGSM.com> Message-ID: Alexei Ustyuzhaninov wrote in news:3DE73A1C.5020901 @UralskyGSM.com: > Hi! > > I have ran into a silly problem with DCOracle2. It returns wrong float > numbers from SELECT statement. > > bash-2.04$ cat test.py > import DCOracle2 > db = DCOracle2.connect("x/y@z") > c = db.cursor() > c.execute("SELECT 0.5 FROM DUAL") > print c.fetchone() > > bash-2.04$ python test.py > [3.6097722056218853] > > Unfortunately 0.5 is somewhat different from 3.6097722056218853. > The environment is: > HP-UX 11.11 > python 2.2.2 > DCOracle2 1.2 > > Could somebody give me a tip on the problem please? > I can't reproduce your problem either, and as best I can my setup is exactly like yours. >>>> cur = dbutils.conn.cursor() >>>> cur.execute('select 0.5 from dual') > 1 >>>> r = cur.fetchone() >>>> print r > [0.5] >>>> > plusk@falcon> uname -a > HP-UX falcon B.11.11 U 9000/800 110901527 unlimited-user license > plusk@falcon> pyth.sh > Python 2.2.2 (#3, Oct 23 2002, 11:37:42) [C] on hp-ux11 > Type "help", "copyright", "credits" or "license" for more information. >>>> DCOracle2 version # $Id: DCOracle2.py,v 1.84 2002/04/11 18:21:18 matt Exp $ Paul From psi2006@yahoo.com.ar Mon Dec 2 23:45:29 2002 From: psi2006@yahoo.com.ar (psi2006@yahoo.com.ar) Date: Mon, 2 Dec 2002 20:45:29 -0300 Subject: [DB-SIG] GADFLY : I can't work within Python for DOS. Message-ID: <00a601c29a5c$f06ae040$9ec744c8@nestor> This is a multi-part message in MIME format. ------=_NextPart_000_00A3_01C29A43.BFF3AFA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: Quoted-Printable Hello there, Just a "beginner" question I tried to run C:\PythonDOS=20 I ran from the command line C:\ DOS4GW PhytonDos.exe Python interpreter fails to load anyfile.py ..... (can't open module xxx) Is it matter of how DOS manages Extended memory or conflicts with DOS4GW (W= atcom related stuff) I have discharged any matter of path as I have my autoexec.bat as follows: PATH=3DC:\PythonDOS; C:\Python21 (also I working under Win98) and within Config.sys EMM386.SYS DOS=3DHIGH My Question: ************** Can I do DB tasks within Pythos for DOS the same as I can fulfill within P= ython IDLE or PythonWin? I have recently downloaded GADFLY so as I will not use anyGUI I think to u= se DOS machines for development. I wonder what it is wrong with Python for DOS (I need that for some student= s on old 386 machines without WIN licences) Thanks in advance Rafael ------=_NextPart_000_00A3_01C29A43.BFF3AFA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: Quoted-Printable
Hello there,
 
Just a "beginner" question
 
I tried to=20 run  C:\PythonDOS 
 
I ran from the command line C:\  DOS4= GW =20 PhytonDos.exe
 
Python interpreter fails to load=20 anyfile.py  ..... (can't open module xxx)
 
Is it matter of how DOS manages Extended m= emory or=20 conflicts with DOS4GW (Watcom related stuff)
 
I have discharged any matter of path = as I have=20 my autoexec.bat as follows:
 
PATH=3DC:\PythonDOS; C:\Python21 (also I w= orking=20 under Win98)
 
and within Config.sys
 
EMM386.SYS
DOS=3DHIGH
 
My Question:
**************
 
Can I  do DB tasks within Pythos for = DOS the=20 same as I can fulfill within Python IDLE or PythonWin?
 
I have recently downloaded GADFLY so as I = will not=20 use anyGUI  I think to use DOS machines=20 for development.
 
I wonder what it is wrong with Python for = DOS (I=20 need that for some students on old 386 machines without WIN=20 licences)
 
Thanks in advance
 
Rafael
 
 
------=_NextPart_000_00A3_01C29A43.BFF3AFA0-- From henrik.ekelund@vpd.se Tue Dec 3 16:44:28 2002 From: henrik.ekelund@vpd.se (Henrik Ekelund) Date: Tue, 3 Dec 2002 17:44:28 +0100 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO Message-ID: NAME: adodbapi - A python DB API 2.0 interface to Microsoft ADO DESCRIPTION: A 100% Python-DB API 2.0 compliant module that makes it easy to use Microsoft ADO for connecting with databases and other data sources. Includes pyunit testcases. PLATFORM: Windows only HOMEPAGE: DOWNLOAD: AUTHOR: Henrik Ekelund LICENSE: Lesser GPL (fine for most commercial vendors) ********************************************************************** This email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** From Doug.Shawhan@gecits.ge.com Tue Dec 3 20:55:07 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Tue, 3 Dec 2002 15:55:07 -0500 Subject: [DB-SIG] Trouble with access. Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54F7B@msxcvg02itscge.gecits.ge.com> Hi folks, I am starting to play with Heinrik Ekelund's new adodbapi module. Unfortunately I am a little too inexperienced with access to even get to that pont! :-) I have never worked with access before, having spent all of my database time with psycopg/PostGreSQL, gadfly and the berkelydb-type fun included with python. I am using python2.2 and Access 2000 (9.0.4402 SR-1) As you will see below, I can establish a connection to an existing access database in c:\tmp\ named happy.mdb. All seems to be fine until it is time to create the cursor. --------------------snip------------------------------ import win32com.client import mx.DateTime as datelibrary import adodbapi #prepare the connnection conn=win32com.client.Dispatch("ADODB.Connection") #prepare connection information dbstuff= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\tmp\\happy.mdb;" #make connection conn.Open(dbstuff) #create cursor c=conn.cursor() ----------------snip------------------------------- It gives the following error: Traceback (most recent call last): File "access_test.py", line 12, in ? c=conn.cursor() File "C:\Python22\lib\site-packages\win32com\client\dynamic.py", line 432, in __getattr__ raise pythoncom.com_error, details pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'ADODB.Connection', 'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.', 'C:\\WINNT\\HELP\\ADO210.CHM', 0, -2146825287), None) >Exit code: 1 Can someone either cluebat me with a quick fix to this or point me to a nice python/access HOWTO? I can't seem to find any floating around. Thanks! d From ramrom@earthling.net Wed Dec 4 01:27:12 2002 From: ramrom@earthling.net (Bob Gailer) Date: Tue, 03 Dec 2002 18:27:12 -0700 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: Message-ID: <5.2.0.9.0.20021203105816.04073968@66.28.54.253> --=====================_88174207==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed At 05:44 PM 12/3/2002 +0100, Henrik Ekelund wrote: >NAME: > adodbapi - A python DB API 2.0 interface to Microsoft ADO > >HOMEPAGE: > I followed the Microsoft ADO link to http://www.microsoft.com/data/ado/. I am immediately totally lost. I tried the Visual Basic Examples; MS has them organized alphabetically; there is no sense of where to start, especially for an ADO beginner. Looking at the first example just has me even more lost. Is there an ADO tutorial? Bob Gailer mailto:ramrom@earthling.net 303 442 2625 --=====================_88174207==.ALT Content-Type: text/html; charset="us-ascii" At 05:44 PM 12/3/2002 +0100, Henrik Ekelund wrote:

NAME:
    adodbapi - A python DB API 2.0 interface to Microsoft ADO

HOMEPAGE:
    <http://adodbapi.sourceforge.net>

I followed the Microsoft ADO link to http://www.microsoft.com/data/ado/. I am immediately totally lost. I tried the Visual Basic Examples; MS has them organized alphabetically; there is no sense of where to start, especially for an ADO beginner. Looking at the first example just has me even more lost. Is there an ADO tutorial?

Bob Gailer
mailto:ramrom@earthling.net
303 442 2625
--=====================_88174207==.ALT-- From andy47@halfcooked.com Wed Dec 4 09:13:33 2002 From: andy47@halfcooked.com (Andy Todd) Date: Wed, 4 Dec 2002 09:13:33 +0000 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: <5.2.0.9.0.20021203105816.04073968@66.28.54.253> References: <5.2.0.9.0.20021203105816.04073968@66.28.54.253> Message-ID: <20021204091333.GA2356@LATITUDE6> On Tue, Dec 03, 2002 at 06:27:12PM -0700, Bob Gailer wrote: > > I followed the Microsoft ADO link to > http://www.microsoft.com/data/ado/. I am immediately totally lost. I tried > the Visual Basic Examples; MS has them organized alphabetically; there is > no sense of where to start, especially for an ADO beginner. Looking at the > first example just has me even more lost. Is there an ADO tutorial? > > Bob Gailer > mailto:ramrom@earthling.net > 303 442 2625 Try http://www.w3schools.com/ado/default.asp. Their tutorials are usually pretty easy to follow, and to the point as well. Regards, Andy -- -------------------------------------------------------------------------------- >From the desk of Andrew J Todd esq http://www.halfcooked.com/ From andy47@halfcooked.com Wed Dec 4 09:29:15 2002 From: andy47@halfcooked.com (Andy Todd) Date: Wed, 4 Dec 2002 09:29:15 +0000 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: References: Message-ID: <20021204092915.GB2356@LATITUDE6> On Tue, Dec 03, 2002 at 05:44:28PM +0100, Henrik Ekelund wrote: > NAME: > adodbapi - A python DB API 2.0 interface to Microsoft ADO > > DESCRIPTION: > A 100% Python-DB API 2.0 compliant module that > makes it easy to use Microsoft ADO for connecting > with databases and other data sources. Includes > pyunit testcases. > > PLATFORM: > Windows only > > HOMEPAGE: > > > DOWNLOAD: > > > AUTHOR: > Henrik Ekelund > > LICENSE: > Lesser GPL (fine for most commercial vendors) > > Henrik, Great work, keep it up. Its probably worth a mention (on the web site or in the documentation) that mxDateTime is a mandatory pre-requisite for your module. Oh, and that you either have ActiveState Python or the win32all extensions installed on top of the PythonLabs distribution. Regards, Andy -- -------------------------------------------------------------------------------- >From the desk of Andrew J Todd esq http://www.halfcooked.com/ From msanchez@grupoburke.com Wed Dec 4 11:50:00 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 04 Dec 2002 12:50:00 +0100 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: <20021204092915.GB2356@LATITUDE6> References: <20021204092915.GB2356@LATITUDE6> Message-ID: <1039002599.1360.15.camel@cynar> --=-4RhhqhQlMC5S+moyfr60 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable I must add that using the COM Makepy utility improves performance seriously. The component to register is: Microsoft ActiveX Data Objects X.X Library (X.X) You should register the latest version in your system (mine is 2.7). El mi=E9, 04-12-2002 a las 10:29, Andy Todd escribi=F3: > On Tue, Dec 03, 2002 at 05:44:28PM +0100, Henrik Ekelund wrote: > > NAME: > > adodbapi - A python DB API 2.0 interface to Microsoft ADO > >=20 > > DESCRIPTION: > > A 100% Python-DB API 2.0 compliant module that=20 > > makes it easy to use Microsoft ADO for connecting > > with databases and other data sources. Includes > > pyunit testcases.=20 > >=20 > > PLATFORM: > > Windows only > >=20 > > HOMEPAGE: > > > >=20 > > DOWNLOAD: > > > >=20 > > AUTHOR: > > Henrik Ekelund > >=20 > > LICENSE: > > Lesser GPL (fine for most commercial vendors) > >=20 > >=20 >=20 > Henrik,=20 >=20 > Great work, keep it up. Its probably worth a mention (on the web site or = in the documentation) that mxDateTime is a mandatory pre-requisite for your= module. Oh, and that you either have ActiveState Python or the win32all ex= tensions installed on top of the PythonLabs distribution. >=20 > Regards, > Andy --=20 Marcos S=E1nchez Provencio www.burke.es --=-4RhhqhQlMC5S+moyfr60 Content-Type: application/pgp-signature; name=signature.asc Content-Description: Esta parte del mensaje esta firmada digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA97evnTwXdxLmtmxsRAhjnAJ9OzmmXH2li51936+eWIfa9xnmrowCffnOw e84KU1FBSJgHNuv9unkeLtU= =7cLt -----END PGP SIGNATURE----- --=-4RhhqhQlMC5S+moyfr60-- From msanchez@grupoburke.com Wed Dec 4 12:01:34 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 04 Dec 2002 13:01:34 +0100 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: References: Message-ID: <1039003293.1361.17.camel@cynar> --=-W2uSFLoAK/vVEeQ1Xl+z Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable =BFDid you study the GetRows() method for performance? El mar, 03-12-2002 a las 17:44, Henrik Ekelund escribi=F3: > NAME: > adodbapi - A python DB API 2.0 interface to Microsoft ADO >=20 > DESCRIPTION: > A 100% Python-DB API 2.0 compliant module that=20 > makes it easy to use Microsoft ADO for connecting > with databases and other data sources. Includes > pyunit testcases.=20 >=20 > PLATFORM: > Windows only >=20 > HOMEPAGE: > >=20 > DOWNLOAD: > >=20 > AUTHOR: > Henrik Ekelund >=20 > LICENSE: > Lesser GPL (fine for most commercial vendors) >=20 >=20 > ********************************************************************** > This email message has been swept by > MIMEsweeper for the presence of computer viruses. >=20 > www.mimesweeper.com > ********************************************************************** >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig --=20 Marcos S=E1nchez Provencio www.burke.es --=-W2uSFLoAK/vVEeQ1Xl+z Content-Type: application/pgp-signature; name=signature.asc Content-Description: Esta parte del mensaje esta firmada digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA97e6dTwXdxLmtmxsRAncPAKCL6efryrJkRNREwr2lC5m/3RjkXACffW6P jMKTxD6LIkCMu/JSoKAokZ8= =kQaD -----END PGP SIGNATURE----- --=-W2uSFLoAK/vVEeQ1Xl+z-- From Mark Matthews Thu Dec 12 05:02:38 2002 From: Mark Matthews (Dave Cole) Date: 12 Dec 2002 16:02:38 +1100 Subject: [DB-SIG] Object Craft Python modules announcement Message-ID: Hello all. The purpose of this message is to collect some testimonials from the users of our Open Source software. We have recently joined Open Source Victoria (http://www.osv.org.au), which has the stated objective of being: "a new advocacy group formed to educate Victoria's (Australian) business and government leaders about the benefits of using Open Source software for both server and desktop environments." Your stories will be used to help the advocacy efforts of Open Source Victoria and more importantly, raise the profile of Open Source in general. (Of course it also helps us and our software stand out in the local market). Open Source advocacy obviously lacks the benefit of an enormous marketing budget, and therefore requires efforts at a grass roots level. Business and Government are generally very conservative and need to see that other organisations have successfully deployed Open Source products. Our products are: Albatross - A Toolkit for Highly Stateful Web Applications http://www.object-craft.com.au/projects/albatross/ CSV - A high performance CSV parser for Python http://www.object-craft.com.au/projects/csv/ MSSQL - A MS SQL Server module for Python http://www.object-craft.com.au/projects/mssql/ Paint - A fast, simple Python wrapper of libart, freetype, and libpng. http://www.object-craft.com.au/projects/paint/ sdk32 - A partial Python Wrap of the Win32 Platform SDK http://www.object-craft.com.au/projects/sdk32/ Sybase - A Sybase module for Python http://www.object-craft.com.au/projects/sybase/ It may come as a surprise, but we really have very little idea of who is using our software and what they are using it for. We would love to hear from you. Any contribution will be greatly appreciated. Please send email to: Mark Matthews Object Craft Pty Ltd. -- http://www.object-craft.com.au From wilk-ml@flibuste.net Thu Dec 12 13:42:29 2002 From: wilk-ml@flibuste.net (William Dode) Date: 12 Dec 2002 14:42:29 +0100 Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: <1039003293.1361.17.camel@cynar> References: <1039003293.1361.17.camel@cynar> Message-ID: <87pts7tku2.fsf@flibuste.net> --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Marcos S=E1nchez Provencio writes: --=-=-= Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable > =BFDid you study the GetRows() method for performance? The adodb.py of opalgroup (http://opensource.theopalgroup.com/) use getrows and is 10x faster on table of 8000 rows. Maybe it could be good to unify theses two adopy... --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable --=20 William Dod=E9 - http://flibuste.net --=-=-=-- From jacobs@penguin.theopalgroup.com Thu Dec 12 13:56:56 2002 From: jacobs@penguin.theopalgroup.com (Kevin Jacobs) Date: Thu, 12 Dec 2002 08:56:56 -0500 (EST) Subject: [DB-SIG] ANN: adodbapi - A python DB API 2.0 interface to Microsoft ADO In-Reply-To: <87pts7tku2.fsf@flibuste.net> Message-ID: On 12 Dec 2002, William Dode wrote: >> =BFDid you study the GetRows() method for performance? > >The adodb.py of opalgroup (http://opensource.theopalgroup.com/) use >getrows and is 10x faster on table of 8000 rows. >Maybe it could be good to unify theses two adopy... [Note: I am the developer for adodb.py] I've been meaning to take a closer look at adodbapi, but I keep running o= ut of time. If should be fairly easy to merge the best ideas from the two projects, which in turn will hopefully draw more developers and users to = the project. Also, thanks for the performance numbers! We tried several different techniques to speed up GetRows and that was the best we came up with at t= he time. Regards, -Kevin -- Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com From guy robinson" Hello, Do I need to use calldll to extract a list of already defined DSN's on windows? If so how? I've looked at microsofts API for ODBC and I can't see how you list the names. Any help appreciated. Guy From guy robinson" Hello, I have a number of access databases that I want to check to see whether they have been updated by another application. (I only read from these databases) The only way I can see is to compare the .mdb last modified times which doesn't seem like a very good programming technique. Any other suggestions? Regards, Guy From mal@lemburg.com Sat Dec 14 11:01:54 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Sat, 14 Dec 2002 12:01:54 +0100 Subject: [DB-SIG] Generating a list of DSN's? References: <001801c2a2f8$29f18b40$0100a8c0@ferrari> Message-ID: <3DFB0FA2.9040604@lemburg.com> guy robinson wrote: > Hello, > > Do I need to use calldll to extract a list of already defined DSN's on > windows? If so how? I've looked at microsofts API for ODBC and I can't see > how you list the names. Check out mx.ODBC.Windows.DataSources() (part of mxODBC). -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From working4aliving@hotmail.com Sat Dec 14 17:13:19 2002 From: working4aliving@hotmail.com (working4aliving) Date: Sat, 14 Dec 2002 12:13:19 -0500 Subject: [DB-SIG] Generating a list of DSN's? References: <001801c2a2f8$29f18b40$0100a8c0@ferrari> Message-ID: ODBC.ini still exists.... (on W2k). ----- Original Message ----- From: "guy robinson" To: Sent: Friday, December 13, 2002 5:33 PM Subject: [DB-SIG] Generating a list of DSN's? > Hello, > > Do I need to use calldll to extract a list of already defined DSN's on > windows? If so how? I've looked at microsofts API for ODBC and I can't see > how you list the names. > > Any help appreciated. > > Guy > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > From working4aliving@hotmail.com Sat Dec 14 17:15:52 2002 From: working4aliving@hotmail.com (working4aliving) Date: Sat, 14 Dec 2002 12:15:52 -0500 Subject: [DB-SIG] checking for updated access database References: <001901c2a2f8$54a6ec90$0100a8c0@ferrari> Message-ID: I've used a simple time stamp column with a default value of =now() to check on data entry of records... There are some hidden table in access, (view, options menu, maybe) but i'm not sure if that'll help. ----- Original Message ----- From: "guy robinson" To: Sent: Friday, December 13, 2002 5:38 PM Subject: [DB-SIG] checking for updated access database > Hello, > > I have a number of access databases that I want to check to see whether they > have been updated by another application. (I only read from thee databases) > The only way I can see is to compare the .mdb last modified times which > doesn't seem like a very good programming technique. Any other suggestions? > > Regards, > > Guy > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > From ramrom@earthling.net Sat Dec 14 18:11:17 2002 From: ramrom@earthling.net (Bob Gailer) Date: Sat, 14 Dec 2002 11:11:17 -0700 Subject: [DB-SIG] Generating a list of DSN's? In-Reply-To: <3DFB0FA2.9040604@lemburg.com> References: <001801c2a2f8$29f18b40$0100a8c0@ferrari> Message-ID: <5.2.0.9.0.20021214111020.02aa6388@66.28.54.253> >mx.ODBC.Windows.DataSources() ? >>> import mx >>> mx.ODBC.Windows.DataSources() Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'ODBC' What am I missing? Bob Gailer mailto:ramrom@earthling.net 303 442 2625 From haering_postgresql@gmx.de Mon Dec 16 00:00:12 2002 From: haering_postgresql@gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Mon, 16 Dec 2002 01:00:12 +0100 Subject: [DB-SIG] [ANN] pyPgSQL 2.3 released Message-ID: <20021216000011.GD11551@lilith.ghaering.test> [Yes, I know this announcement is going out a week late] Announce: pyPgSQL - Version 2.3 is released. =========================================================================== pyPgSQL v2.3 has been released. It is available at http://pypgsql.sourceforge.net. pyPgSQL is a package of two (2) modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, is written in C and exports the PostgreSQL C API to Python. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python and works with PostgreSQL 7.0 or later and Python 2.0 or later. It was tested with PostgreSQL 7.0.3, 7.1.3, 7.2.2, 7.3, Python 2.0.1, 2.1.3 and 2.2.2. Note: It is highly recommended that you use PostgreSQL 7.2 or later and Python 2.1 or later. If you want to use PostgreSQL Large Objects under Python 2.2.x, you *must* use Python 2.2.2, because of a bug in earlier 2.2 versions. Project homepages: pyPgSQL: http://pypgsql.sourceforge.net/ PostgreSQL: http://www.postgresql.org/ Python: http://www.python.org/ While there didn't change much under the hood, the build process was completely rewritten, so pyPgSQL should now build out of the box on most popular platforms. For you, this means that a "python setup.py build" will now hopefully just work. And for us, this means we'll have to answer less boring support questions :-) These platforms were tested and will build out of the box (of course, more testing won't hurt): UnixWare 7/OpenUNIX 8, Windows native, Cgwin, FreeBSD 4.7, Redhat Linux 7.3, SuSE Linux 7.3, Debian Linux 3.0. The build process is also designed to work with these platforms, but they could not be tested in real life (please do so, if you can!): Mandrake Linux, NetBSD, OpenBSD, MacOS X. If your platform isn't supported out of the box, you can edit a setup.py file to configure the build process. Patches for supporting additional platforms are more than welcome. Look into setup.py for how to do it. The other big change is that Gerhard finally gave up on getting more feedback on his Unicode patch and merged it into the pyPgSQL 2.x line. Hey, if it did work for Linux 2.4, it can work for us, too <0.7 wink>. Using Unicode works like this: from pyPgSQL import PgSQL con = PgSQL.connect(client_encoding=("utf-8", "ignore"), unicode_results=1) # where client_encoding are the parameters you normally give to the encode # method of a Unicode string. unicode_results=1 means pyPgSQL will return # VARCHAR/CHAR/TEXT fields as Unicode strings instead of byte strings. # As I refuse to do any magic, you'll also have to set the client encoding # for the database manually: cursor = con.cursor() cursor.execute("SET CLIENT_ENCODING TO UNICODE") # There are other ways to set the client encoding, including setting a # special environment variable (see PostgreSQL manual), but I recommend # doing it in code. Support for reference cursors was added. Since PostgreSQL 7.2, you could create cursors in PL/pgSQL and pass a reference to the open cursor back to the client. PgSQL will now cast those referenced cursors into a Cursor object that can be used to fetch the results in the cursor. For example (assuming that mmYearInfo() returns a reference curosr): $ python Python 2.2.2 (#7, Nov 27 2002, 17:10:05) [C] on openunix8 Type "help", "copyright", "credits" or "license" for more information. >>> from pyPgSQL import PgSQL >>> cx = PgSQL.connect(database='esi') >>> cu = cx.cursor() >>> cu.callproc('mmYearInfo') >>> rs = cu.fetchone() >>> rs [] >>> c = rs[0] >>> for i in c.description: ... print i ... ['model_year', varchar, 4, 8, None, None, None, 0] ['mktg_div_name', varchar, 50, 54, None, None, None, 0] ['model_desc', varchar, 50, 54, None, None, None, 0] ['book_types', varchar, 50, 54, None, None, None, 0] ['vehicle_syskey', integer, 4, 4, None, None, None, 0] >>> r = c.fetchone() >>> r ['2003', 'Buick', 'Century', '1;8;9', 2211] >>> --------------------------------------------------------------------------- ChangeLog: =========================================================================== Changes since pyPgSQL Version 2.2 ================================= The following source code files were added to Version 2.3 of pyPgSQL: unicode_tests.py - Test suite for the new Unicode support. Merged from the Unicode patch. Changes to setup.py ------------------- * This file was rewritten entirely so that pyPgSQL now builds out of the box on Windows, Cygwin, Debian Linux, Redhat Linux, SuSE Linux, FreeBSD, UnixWare 7 and OpenUNIX 8. These are the platforms the new build process has been tested on. Untested support is available for Mandrake Linux, NetBSD, OpenBSD and MacOS X. Changes to README ----------------- * Updates for 2.3. * Converted the whole document into reStructuredText, so we can easily built a HTML version using docutils (http://docutils.sf.net/). Changes to README.win32 ----------------------- * Remove out of date warning about PostgreSQL on win32 * Reflected change from windows/ to ports/ Changes to PgSQL.py ------------------- * Fixed various problems with the PgNumeric constructor and formatting routines. * Fixed problems with new __setupTransaction function: | 1. Made it a method of Connection, not Cursor. 2. inTransaction was only set if TransactionLevel was set. * Fixed instances where method name was incorrect: Connection__gcCursor -> _Connection__gcCursor Connection__closeCursor -> _Connection__closeCursor * Cleaned up code where there was unneeded references to conn in Connection class. | * Handle the new '__quote__' method for arrays, too. * Still handle '_quote' methods for backwards compatibility. * Fixed changed PG_TIMESTAMP oid, added PG_TIMESTAMPTZ and PG_REFCURSOR oids. * Reference cursors are now type-casted into cursor objects. * Completed the emulation of a String object for the PgBytea and PgOther classes. This corrects several problems with PgBytea concerning compari- sons, using PgBytea types as keys in dictionaries, etc. * Added the __hash__ function to the PgNumeric class. Cleaned up the code in PgNumeric class and made some small improvments to it. * Added the PgArray class. This is a wrapper around a Python list and is used for all PostgreSQL arrays. This change was made so that lists and tuples no longer have a special meaning in the Cursor.execute() method. * Changed the quoting methods defined in the various classes defining PostgreSQL support types to __quote__. * Merged the Unicode patch. pyPgSQL now has full Unicode support. * Added support for the INTERVAL type. * mxDateTime 1.x is no longer supported. Require mxDateTime 2.x and give useful error message if import fails. * Cosmetic changes: use cmp builtin where appropriate. * Fixed typo where PgTypes.__str__ was spelled incorrectly; compare to None using "is" operator. * Take into account that libpq.PgInt8Type might not be available. * Convert ROWID to PgInt8 instead of PgInt4 (the original behaviour led to overflow errors.) * Always set the displaysize field of cursor.description to -1. PostgreSQL 7.3 doesn't provide this information any more and it's pretty useless nowadays that we've mostly left line printers beyond us. Changes to pyPgSQL/__init__.py ------------------------------ * Register libpq.PgInt8 with copy_reg only if available. Changes to pglargeobject.c -------------------------- * Made the 'closed' attribute of PgLargeObject an int instead of a long. Changes to libpqmodule.c: ------------------------- * Fixed the changed PG_TIMESTAMP oid, added PG_TIMESTAMPTZ and PG_REFCURSOR oids. [Bug #845360] * Fixed the format string of ParseTuple in libPQbool_FromInt. This closes a bug that appeared on Linux/Alpha (#625121). Changes to pgversion.c: ----------------------- * Changed pgversion to recognize release canidate versions of PostgreSQL. Changes to PgSQL test cases: ---------------------------- * Updated test cases to allow for changes in PostgreSQL 7.3. * Don't check for the obsolete displaysize field in cursor.description. Also don't check the backend encoding. Multiple files -------------- The windows/ directory has been moved to a port/ directory. Now we *always* use our own version of various string versions instead of special casing for a dozen different Windows and Unix platforms. In order to get the C version of PgInt8Type, it is now required that the constants LLONG_MAX, LLONG_MIN, ULLONG_MAX and ULLONG_MIN are defined when including limits.h and that including Python.h defines HAVE_LONG_LONG. Otherwise, a Python class is used instead. From ernesto.molina@externo.mju.es Mon Dec 16 09:49:57 2002 From: ernesto.molina@externo.mju.es (Molina Carron) Date: Mon, 16 Dec 2002 10:49:57 +0100 Subject: [DB-SIG] Generating a list of DSN's? References: <001801c2a2f8$29f18b40$0100a8c0@ferrari> <5.2.0.9.0.20021214111020.02aa6388@66.28.54.253> Message-ID: <002f01c2a4e8$7e0945a0$e77a0c0a@mju.es> have u installed mx.ODBC? Maybe you installed only the base package Try "import mx.ODBC" and once you notice you haven't installed it, go to http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Packages and download it >>> import mx.ODBC >>> mx.ODBC.Windows.DataSources() {'menores_login': 'Controlador ODBC de Oracle', 'MS Access 97 Database': 'Microsoft Access Driver (*.mdb)', 'FoxPro Files': 'Microsoft FoxPro Driver (*.dbf)', 'Text Files': 'Microsoft Text Driver (*.txt; *.csv)', 'SUN10000': 'Controlador ODBC de Oracle', 'menores_2': 'Controlador ODBC de Oracle', 'DESJUS': 'Controlador ODBC de Oracle', 'Excel Files': 'Microsoft Excel Driver (*.xls)', 'DESMENORES': 'Controlador ODBC de Oracle', 'xx': 'Microsoft Access Driver (*.mdb)', 'FoxPro Files - Word': 'Microsoft FoxPro VFP Driver (*.dbf)', 'menores': 'Controlador ODBC de Oracle', 'Visual FoxPro Database': 'Microsoft Visual FoxPro Driver', 'MQIS': 'SQL Server', 'dBase Files - Word': 'Microsoft dBase VFP Driver (*.dbf)', 'MS Access Database': 'Microsoft Access Driver (*.mdb)', 'ORAL': 'Controlador ODBC de Oracle', 'dBASE Files': 'Microsoft dBase Driver (*.dbf)', 'Visual FoxPro Tables': 'Microsoft Visual FoxPro Driver'} >>> ----- Original Message ----- From: "Bob Gailer" To: "M.-A. Lemburg" ; "guy robinson" Cc: Sent: Saturday, December 14, 2002 7:11 PM Subject: Re: [DB-SIG] Generating a list of DSN's? > > >mx.ODBC.Windows.DataSources() ? > > >>> import mx > >>> mx.ODBC.Windows.DataSources() > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'module' object has no attribute 'ODBC' > > What am I missing? > > Bob Gailer > mailto:ramrom@earthling.net > 303 442 2625 > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig From alust@UralskyGSM.com Mon Dec 16 15:08:37 2002 From: alust@UralskyGSM.com (Alexei Ustyuzhaninov) Date: Mon, 16 Dec 2002 20:08:37 +0500 Subject: [DB-SIG] Re: Returning floats in DCOracle2 Message-ID: <3DFDEC75.4030401@UralskyGSM.com> Yes, you are right. The matter was in the decimal separator. Setting it manually to "." resolves the problem. Thank you for the help. bash-2.04$ cat test.py import DCOracle2 db = DCOracle2.connect("x/y@z") c = db.cursor() c.execute("ALTER SESSION SET NLS_NUMERIC_CHARACTERS='. '") c.execute("SELECT 0.5 FROM DUAL") print c.fetchone() bash-2.04$ python test.py [0.5] Matthew T. Kromer wrote: > The problem may have to do with a mismatch between the C locale's=20 > sscanf() function for parsing numbers, and Oracle's numeric formatting=20 > environment setting. This might come from the difference between trying=20 > to parse "0.5" using "," as the decimal separator or vice versa ("0,5"=20 > with "."). > > The reason DCOracle2's C layer handles numbers as strings is old, and no=20 > longer valid (it used to cause problems under Linux to initialize in=20 > Object mode). At some point in time I'll rip out all of the string /=20 > number conversion (which usses sscanf()) and replace it with various=20 > OCINumber calls. > > Alternatively, there might be a compiler problem. > > I was unable to reproduce the problem myself. > > > jno wrote: > >>could not reproduce: >> >>[jno@hypnos jno]$ python =20 >>Python 2.1.3 (#2, Jul 24 2002, 11:13:04) [C] on hp-uxB >>Type "copyright", "credits" or "license" for more information. >> =20 >> >>>>>import DCOracle >>>>>d =3D DCOracle.Connect('xxx/xxx@xxx') >>>>>c =3D d.cursor() >>>>>c.execute('select 0.5 from dual') >>>>>r=3Dc.fetchall() >>>>>c.close() >>>>>print r >>>>> =20 >>>>> >>[(0.5,)] >> =20 >> >>[jno@hypnos jno]$ uname -a >>HP-UX hypnos B.11.00 U 9000/800 654339382 unlimited-user license >>[jno@hypnos jno]$=20 >> >>well, it is NOT DCO2, Py 2.2.2 and HP-UX 11.11 ;-) >> >>-jno >> >>=F7 =F0=D4=CE, 29.11.2002, =D7 12:57, Alexei Ustyuzhaninov =CE=C1=D0=C9=D3= > =C1=CC: >> =20 >> >>>Hi! >>> >>>I have ran into a silly problem with DCOracle2. It returns wrong float=20 >>>numbers from SELECT statement. >>> >>>bash-2.04$ cat test.py >>>import DCOracle2 >>>db =3D DCOracle2.connect("x/y@z") >>>c =3D db.cursor() >>>c.execute("SELECT 0.5 FROM DUAL") >>>print c.fetchone() >>> >>>bash-2.04$ python test.py >>>[3.6097722056218853] >>> >>>Unfortunately 0.5 is somewhat different from 3.6097722056218853. >>>The environment is: >>>HP-UX 11.11 >>>python 2.2.2 >>>DCOracle2 1.2 >>> >>>Could somebody give me a tip on the problem please? -- Best regards, Alexei Ustyuzhaninov From matt@zope.com Mon Dec 16 15:20:57 2002 From: matt@zope.com (Matthew T. Kromer) Date: Mon, 16 Dec 2002 10:20:57 -0500 Subject: [DB-SIG] Re: Returning floats in DCOracle2 References: <3DFDEC75.4030401@UralskyGSM.com> Message-ID: <3DFDEF59.2030807@zope.com> Alexei Ustyuzhaninov wrote: > Yes, you are right. The matter was in the decimal separator. Setting > it manually to "." resolves the problem. Thank you for the help. > > bash-2.04$ cat test.py > import DCOracle2 > db = DCOracle2.connect("x/y@z") > c = db.cursor() > c.execute("ALTER SESSION SET NLS_NUMERIC_CHARACTERS='. '") > c.execute("SELECT 0.5 FROM DUAL") > print c.fetchone() I have some code checked into CVS now that should handle numeric conversion better; but it's not complete for stored procedures yet. The newer code uses a different output format from Oracle (SQLT_VNU vs SQLT_STR) for numeric results. The reason it isnt complete for stored procedures is that the SP code tries to coerce numeric binds into strings, and I havent modified that yet to handle the alternative format. Anyway, the newer OCINumber based code will not require you to change your NLS_NUMERIC_CHARACTERS setting. From american_devils_ak@yahoo.com Tue Dec 17 02:21:22 2002 From: american_devils_ak@yahoo.com (angela kristen) Date: Mon, 16 Dec 2002 18:21:22 -0800 (PST) Subject: [DB-SIG] (no subject) Message-ID: <20021217022122.45163.qmail@web21502.mail.yahoo.com> --0-283552553-1040091682=:43413 Content-Type: text/plain; charset=us-ascii Confirmed. --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now --0-283552553-1040091682=:43413 Content-Type: text/html; charset=us-ascii Confirmed.



Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now --0-283552553-1040091682=:43413-- From gsjonesjr@yahoo.com Tue Dec 17 23:27:43 2002 From: gsjonesjr@yahoo.com (George Jones) Date: Tue, 17 Dec 2002 15:27:43 -0800 (PST) Subject: [DB-SIG] Problems w/BLOBs Message-ID: <20021217232743.13060.qmail@web80312.mail.yahoo.com> Hello, I'm trying to store binary data in a BLOB in an Oracle 9i db(Is that, 9i rather than 8, my problem?). I'm new to Python, and very new to DCOracle2, which is the module I'm using to connect to the db. I'm able to load the data into the db, although not in the way that the documentation suggests, but when I retrieve it the LobLocator Object's read method wont work. in_file = open('boo','rb') input_string = in_file.read() import DCOracle2 db = DCOracle2.connect('blah/blah') c = db.cursor() c.execute('insert into my_blob values(:1, :2)', 1, \ DCOracle.Binary(input_string, 'SQLT_BLOB') db.commit() c.execute('select file_data from my_blob where file_id\ = 1') result = c.fetchone() res_obj = result[0] print res_obj.length() # this gives right length 138240 out_string = res_obj.read() # this gives nothing So what am I doing wrong? TIA GSJ __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From working4aliving@hotmail.com Wed Dec 18 04:21:42 2002 From: working4aliving@hotmail.com (working4aliving) Date: Tue, 17 Dec 2002 23:21:42 -0500 Subject: [DB-SIG] Problems w/BLOBs References: <20021217232743.13060.qmail@web80312.mail.yahoo.com> Message-ID: I'm a newbie w/ this george, but in Zope, I return what you would have as res_obj and I can then view the blob... when I return from my python function the out_string, as you do, i get "machine code" on the screen... (hahaha old 80's joke:) ). I'm not sure if this helps you. here's my script (realizing it's called from within zope) result = [] lob = ['image1'] for row in context.sqlimage1(id=id): lob = row['image1'] # result.append({'image1': lob.read()}) # above was remmed return lob Good luck, blobs suck (only kidding, but it DOES rhyme) Bob ----- Original Message ----- From: "George Jones" To: Sent: Tuesday, December 17, 2002 6:27 PM Subject: [DB-SIG] Problems w/BLOBs > Hello, > I'm trying to store binary data in a BLOB in an > Oracle 9i db(Is that, 9i rather than 8, my problem?). > I'm new to Python, and very new to DCOracle2, which is > the module I'm using to connect to the db. I'm able > to load the data into the db, although not in the way > that the documentation suggests, but when I retrieve > it the LobLocator Object's read method wont work. > > in_file = open('boo','rb') > input_string = in_file.read() > > import DCOracle2 > db = DCOracle2.connect('blah/blah') > c = db.cursor() > c.execute('insert into my_blob values(:1, :2)', 1, \ > DCOracle.Binary(input_string, 'SQLT_BLOB') > db.commit() > c.execute('select file_data from my_blob where > file_id\ = 1') > result = c.fetchone() > res_obj = result[0] > print res_obj.length() # this gives right length > 138240 > out_string = res_obj.read() # this gives nothing > > So what am I doing wrong? > TIA > GSJ > > > __________________________________________________ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > From mal@lemburg.com Wed Dec 18 09:52:25 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 18 Dec 2002 10:52:25 +0100 Subject: [DB-SIG] Generating a list of DSN's? References: <001801c2a2f8$29f18b40$0100a8c0@ferrari> <5.2.0.9.0.20021214111020.02aa6388@66.28.54.253> Message-ID: <3E004559.80409@lemburg.com> Bob Gailer wrote: > >> mx.ODBC.Windows.DataSources() ? > > > >>> import mx > >>> mx.ODBC.Windows.DataSources() > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'module' object has no attribute 'ODBC' > > What am I missing? You need the egenix-mx-commercial package from eGenix.com. This includes the mxODBC package. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From matt@zope.com Wed Dec 18 14:48:21 2002 From: matt@zope.com (Matthew T. Kromer) Date: Wed, 18 Dec 2002 09:48:21 -0500 Subject: [DB-SIG] Problems w/BLOBs References: <20021217232743.13060.qmail@web80312.mail.yahoo.com> Message-ID: <3E008AB5.3030906@zope.com> George Jones wrote: >Hello, > I'm trying to store binary data in a BLOB in an >Oracle 9i db(Is that, 9i rather than 8, my problem?). >I'm new to Python, and very new to DCOracle2, which is >the module I'm using to connect to the db. I'm able >to load the data into the db, although not in the way >that the documentation suggests, but when I retrieve >it the LobLocator Object's read method wont work. > > > You're doing it exactly right -- the packaged release has a 1-liner bug that causes it to think that all LOBS are temporary lobs. If you get the CVS release and recompile you should be OK. From gsjonesjr@yahoo.com Wed Dec 18 21:01:43 2002 From: gsjonesjr@yahoo.com (George Jones) Date: Wed, 18 Dec 2002 13:01:43 -0800 (PST) Subject: [DB-SIG] Problems w/BLOBs Message-ID: <20021218210143.28494.qmail@web80314.mail.yahoo.com> Hello all, I followed Matt's suggestion and re-compiled. It worked. Thanks to all for the ideas and documentation. GSJ __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From mmclay@comcast.net Fri Dec 20 12:58:24 2002 From: mmclay@comcast.net (Michael McLay) Date: Fri, 20 Dec 2002 07:58:24 -0500 Subject: [DB-SIG] Fwd: RE: [Python-Dev] RE: Adding decimal (aka FixedPoint) numbers to Python Message-ID: <200212200758.25026.mmclay@comcast.net> There has been a discusion of adding a "decimal" number type to core distribution on the python-dev mailing list over the past couple weeks. This new type would likely be used most often for financial data that is stored in SQL databases. Tim Peters describes two different types of decimal numbers in the forwarded message that is attached to this message. I do not have the insight into the typical SQL database use of decimal numbers. Are they the fixed point type numbers that Tim has implemented in FixedType (with "banker" rounding properties), or are they the Cowlishhaw float numbers as described by Tim? My objective in pushing for adding a decimal type is to have useful decimal numbers that for manipulating data from SQL databases added to Python, I'd like to make sure those numbers have the right semantics for that goal. Comments? ---------- Forwarded Message ---------- Subject: RE: [Python-Dev] RE: Adding decimal (aka FixedPoint) numbers to Python Date: Thu, 19 Dec 2002 00:58:37 -0500 From: Tim Peters To: Michael McLay , python-dev@python.org Cc: dougfort@users.sourceforge.net [Michael McLay] > ... > be a reasonable start. I am concerned about one thing. Will the > fixed point implementation you have implemented be backwards > compatible with an implementation of Cowlishaw's decimal numbers? Nope. Any scheme that can lose information is, in general, incompatible with any other scheme that can lose information, unless they lose information in identical ways in all cases. Since Cowlishaw's is a floating scheme, and FixedPoint is a fixed scheme, they'll get different results in some information-losing cases. Examples aren't hard to find. Here's one: what's 13% of 100006.73? The true result is exactly 10000673 * 13 / 10000 = 13000.8749. Do that via fixed-points with 2 digits after the decimal point, and it's rounded down to 13000.87 (which is the best possible result if you get to keep no more than two digits after the decimal point). Use Cowlishaw's scheme with 8 digits of precision (which counts all digits -- the decimal point floats) instead, and the trailing 9 has to be tossed, and so rounds the last retained digit from 4 up to 5: 13000.875. You've got 8 digits now, but a worse result if pennies are what you need: if you round *that* to the nearest penny, to-nearest/even ("banker's rounding") says "OK, I have to toss the 5, and 7 is odd, so round it up the even 8", leaving 13000.88. The end results aren't the same, and I recall now that this is why FixedPoint was designed to lose info on multiply: when you're computing percentages to the nearest penny (be it sales tax or rebates), you can't get the best possible result in all cases if you use a scheme that rounds twice. A fixed-point scheme can get away with rounding just once (& very naturally), but a floating scheme can have "too many digits", and therefore force the user to do a second rounding step to cut the result back to the number of fractional digits they wanted. Double-rounding can't be as good as single-rounding in all cases, unless the floating scheme uses much more precision than the fixed scheme (there are tricky theorems that kick in then -- if you have "enough" excess precision, it's provable that double-rounding is always the same as single-rounding -- but not one user in a million can be expected to know this, and even if they did the application is too difficult since it effectively requires proving that you've always got enough extra precision relative to your app's specific numbers). BTW, this is why FixedPoint's "good to the last penny" has more to do with the fixed-point business than with the decimal business. Decimal arithmetic is just as prone to double-rounding errors as binary arithmetic, and floats-- whether decimal or binary --force the user into the double-rounding business when they're working with fixed-point quantitities. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev ------------------------------------------------------- From mmclay@comcast.net Fri Dec 20 15:50:07 2002 From: mmclay@comcast.net (Michael McLay) Date: Fri, 20 Dec 2002 10:50:07 -0500 Subject: [DB-SIG] Fwd: RE: [Python-Dev] RE: Adding decimal (aka FixedPoint) numbers to Python Message-ID: <200212201050.07153.mclay@nist.gov> There has been a discusion of adding a "decimal" number type to core distribution on the python-dev mailing list over the past couple weeks. This new type would likely be used most often for financial data that is stored in SQL databases. Tim Peters describes two different types of decimal numbers in the forwarded message that is attached to this message. I do not have the insight into the typical SQL database use of decimal numbers. Are they the fixed point type numbers that Tim has implemented in FixedType (with "banker" rounding properties), or are they the Cowlishhaw float numbers as described by Tim? My objective in pushing for adding a decimal type is to have useful decimal numbers that for manipulating data from SQL databases added to Python, I'd like to make sure those numbers have the right semantics for that goal. Comments? ---------- Forwarded Message ---------- Subject: RE: [Python-Dev] RE: Adding decimal (aka FixedPoint) numbers to Python Date: Thu, 19 Dec 2002 00:58:37 -0500 From: Tim Peters To: Michael McLay , python-dev@python.org Cc: dougfort@users.sourceforge.net [Michael McLay] > ... > be a reasonable start. I am concerned about one thing. Will the > fixed point implementation you have implemented be backwards > compatible with an implementation of Cowlishaw's decimal numbers? Nope. Any scheme that can lose information is, in general, incompatible with any other scheme that can lose information, unless they lose information in identical ways in all cases. Since Cowlishaw's is a floating scheme, and FixedPoint is a fixed scheme, they'll get different results in some information-losing cases. Examples aren't hard to find. Here's one: what's 13% of 100006.73? The true result is exactly 10000673 * 13 / 10000 = 13000.8749. Do that via fixed-points with 2 digits after the decimal point, and it's rounded down to 13000.87 (which is the best possible result if you get to keep no more than two digits after the decimal point). Use Cowlishaw's scheme with 8 digits of precision (which counts all digits -- the decimal point floats) instead, and the trailing 9 has to be tossed, and so rounds the last retained digit from 4 up to 5: 13000.875. You've got 8 digits now, but a worse result if pennies are what you need: if you round *that* to the nearest penny, to-nearest/even ("banker's rounding") says "OK, I have to toss the 5, and 7 is odd, so round it up the even 8", leaving 13000.88. The end results aren't the same, and I recall now that this is why FixedPoint was designed to lose info on multiply: when you're computing percentages to the nearest penny (be it sales tax or rebates), you can't get the best possible result in all cases if you use a scheme that rounds twice. A fixed-point scheme can get away with rounding just once (& very naturally), but a floating scheme can have "too many digits", and therefore force the user to do a second rounding step to cut the result back to the number of fractional digits they wanted. Double-rounding can't be as good as single-rounding in all cases, unless the floating scheme uses much more precision than the fixed scheme (there are tricky theorems that kick in then -- if you have "enough" excess precision, it's provable that double-rounding is always the same as single-rounding -- but not one user in a million can be expected to know this, and even if they did the application is too difficult since it effectively requires proving that you've always got enough extra precision relative to your app's specific numbers). BTW, this is why FixedPoint's "good to the last penny" has more to do with the fixed-point business than with the decimal business. Decimal arithmetic is just as prone to double-rounding errors as binary arithmetic, and floats-- whether decimal or binary --force the user into the double-rounding business when they're working with fixed-point quantitities. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev ------------------------------------------------------- From Doug.Shawhan@gecits.ge.com Tue Dec 31 20:04:44 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Tue, 31 Dec 2002 15:04:44 -0500 Subject: [DB-SIG] Duuuh? - cx_Oracle.DatabaseError: ORA-12560: TNS:protocol adapter error Message-ID: <47B6167F8E69D31194BA0008C7918D42076FE925@msxcvg02itscge.gecits.ge.com> Howdy folks, I am experimenting with cx_Oracle with Python 2.2.1 under NT5 attatching to Oracle 8.0. I am trying the following silly script to establish a connection: ------------------------------------------------------------------ import cx_Oracle DSN='''host=oraclehost.hostie.com, user=doofus, password=g00b3r database=SCHMEH'' conn = cx_Oracle.connect(DSN) ------------------------------------------------------------------ Which gives me: ------------------------------------------------------------------ cx_Oracle.DatabaseError: ORA-12560: TNS:protocol adapter error ------------------------------------------------------------------ I am reasonably sure that all parameters in my DSN string are correct. Can anyone throw me a clue as to what a protocol adaper error is? Thanks! d From ramrom@earthling.net Tue Dec 31 20:27:02 2002 From: ramrom@earthling.net (Bob Gailer) Date: Tue, 31 Dec 2002 13:27:02 -0700 Subject: [DB-SIG] Duuuh? - cx_Oracle.DatabaseError: ORA-12560: TNS:protocol adapter error In-Reply-To: <47B6167F8E69D31194BA0008C7918D42076FE925@msxcvg02itscge.ge cits.ge.com> Message-ID: <5.2.0.9.0.20021231132514.02c27c70@66.28.54.253> --=======3D3D4D64======= Content-Type: text/plain; x-avg-checked=avg-ok-6633D6F; charset=us-ascii; format=flowed Content-Transfer-Encoding: 8bit At 03:04 PM 12/31/2002 -0500, Doug.Shawhan@gecits.ge.com wrote: >using cx_Oracle, Python 2.2.1, Oracle 8.0. >------------------------------------------------------------------ >import cx_Oracle >DSN='''host=oraclehost.hostie.com, > user=doofus, > password=g00b3r > database=SCHMEH'' >conn = cx_Oracle.connect(DSN) >------------------------------------------------------------------ >cx_Oracle.DatabaseError: ORA-12560: TNS:protocol adapter error Do you have the Oracle client installed? Bob Gailer mailto:ramrom@earthling.net 303 442 2625 --=======3D3D4D64======= Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-6633D6F Content-Disposition: inline --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/2002 --=======3D3D4D64=======-- From Doug.Shawhan@gecits.ge.com Tue Dec 31 21:11:13 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Tue, 31 Dec 2002 16:11:13 -0500 Subject: [DB-SIG] Duuuh? - cx_Oracle.DatabaseError: ORA-12560: TNS:pro tocol adapter error Message-ID: <47B6167F8E69D31194BA0008C7918D42076FE926@msxcvg02itscge.gecits.ge.com> Ahhh... That did it! I was working from the DBAPI web page rather than from the README from the Windows binary install. (smack) I did not realize that it would grab the severname from my locally installed Oracle client! :-) (That is what is happening, right?) >>> import cx_Oracle >>> conn = cx_Oracle.connect('myname','mypass','dbname') or >>> conn = cx_Oracle.connect('myname/mypass@dbname') both gave me a happy exit code 0! :-) Thanks very much Anthony! -----Original Message----- From: Anthony Tuininga [mailto:anthony@computronix.com] Sent: Tuesday, December 31, 2002 2:28 PM To: Shawhan, Doug (CAP, ITS, US) Subject: Re: [DB-SIG] Duuuh? - cx_Oracle.DatabaseError: ORA-12560: TNS:protocol adapter error The parameters for the connect method are as follows (see the README.txt included in the release as well for more information) conn = cx_Oracle.connect("user/pw@tnsentry") OR conn = cx_Oracle.connect("user", "pw", "tnsentry") If that still doesn't make sense, let me know and I'll see what I can do to assist. On Tue, 2002-12-31 at 13:04, Doug.Shawhan@gecits.ge.com wrote: > Howdy folks, > > I am experimenting with cx_Oracle with Python 2.2.1 under NT5 attatching to > Oracle 8.0. > > I am trying the following silly script to establish a connection: > > ------------------------------------------------------------------ > import cx_Oracle > DSN='''host=oraclehost.hostie.com, > user=doofus, > password=g00b3r > database=SCHMEH'' > conn = cx_Oracle.connect(DSN) > ------------------------------------------------------------------ > > Which gives me: > > ------------------------------------------------------------------ > > cx_Oracle.DatabaseError: ORA-12560: TNS:protocol adapter error > > ------------------------------------------------------------------ > > I am reasonably sure that all parameters in my DSN string are correct. Can > anyone throw me a clue as to what a protocol adaper error is? > > Thanks! > > d > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig -- Anthony Tuininga anthony@computronix.com Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax: (780) 454-3838 http://www.computronix.com