From 520092297172-0001 at t-online.de Sun Oct 5 12:51:01 2003 From: 520092297172-0001 at t-online.de (520092297172-0001@t-online.de) Date: Sun Oct 5 05:46:54 2003 Subject: [DB-SIG] mertastuttgartdan Message-ID: <000601c38b60$dc09fff0$1202a8c0@hanan> selam sibel ben merta 27 yasinda tek yasiyan diskotekte bodyguatlik yapiyorum ayni zamanda stuuttgart unide mimarligi okuyorum .bende senin gibi erotik iliski ariyorum eyer bulusmak istersen cok sevinirim ve senide mutlu ederim kendim erotik masajlar da bir numarayim diyebilirim romantizime ve kadinin isteklerine sonuna kadar cevap vermeye hazirim beni unutamayacagina garanti veririm eyer istersen ben sana gelirim veya sen istersen bana gelebilirsin 4 odali evim yanliz ikimize ayiririz ve istersen g?zel bir hafta sonu yasayabiliriz ?pt?m merta -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20031005/20b512b6/attachment.html From arkamir at softhome.net Mon Oct 6 18:24:37 2003 From: arkamir at softhome.net (Conrad Koziol) Date: Mon Oct 6 18:24:26 2003 Subject: [DB-SIG] None Value?? Message-ID: <1065479076.5116.9.camel@quercus> Hey what does MySQLdb return if it cant find the value. Like in the code below, what if conrad does not exist in the table users, what would result equal? db = MySQL.connect(host='localhost, user='conrad', passwd='python', db='general') cursor = db.cursor() cursor.execute('SELECT conrad FROM users') result = cursor.fetchall() thanks, Conrad p.s. sorry about the simplicity of the question but i dont have mysqldb set up right now so i cant test it, but im working on it. From chris at cogdon.org Mon Oct 6 18:33:11 2003 From: chris at cogdon.org (Chris Cogdon) Date: Mon Oct 6 18:33:19 2003 Subject: [DB-SIG] None Value?? In-Reply-To: <1065479076.5116.9.camel@quercus> Message-ID: <11243981-F84D-11D7-8C4A-000A95E3823E@cogdon.org> On Monday, Oct 6, 2003, at 15:24 US/Pacific, Conrad Koziol wrote: > Hey what does MySQLdb return if it cant find the value. Like in the > code > below, what if conrad does not exist in the table users, what would > result equal? > > db = MySQL.connect(host='localhost, user='conrad', passwd='python', > db='general') > cursor = db.cursor() > cursor.execute('SELECT conrad FROM users') > result = cursor.fetchall() fetchall, in this instance, will return an empty list. if you run 'fetchone' when there are no, or no more, results, it returns None. -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From chris at cogdon.org Mon Oct 6 18:48:57 2003 From: chris at cogdon.org (Chris Cogdon) Date: Mon Oct 6 18:49:03 2003 Subject: [DB-SIG] None Value?? In-Reply-To: <200310062245.h96Mj4B21028@12-236-54-216.client.attbi.com> Message-ID: <44E1DA24-F84F-11D7-8C4A-000A95E3823E@cogdon.org> On Monday, Oct 6, 2003, at 15:45 US/Pacific, Guido van Rossum wrote: >> On Monday, Oct 6, 2003, at 15:24 US/Pacific, Conrad Koziol wrote: >> >>> Hey what does MySQLdb return if it cant find the value. Like in the >>> code >>> below, what if conrad does not exist in the table users, what would >>> result equal? >>> >>> db = MySQL.connect(host='localhost, user='conrad', passwd='python', >>> db='general') >>> cursor = db.cursor() >>> cursor.execute('SELECT conrad FROM users') >>> result = cursor.fetchall() > > [Chris Cogdon] >> fetchall, in this instance, will return an empty list. >> >> if you run 'fetchone' when there are no, or no more, results, it >> returns None. > > Hm. I'd think that if the table 'users' has no column 'conrad', this > would raise an exception saying approximately "ERROR 1054: Unknown > column 'foo' in 'field list'". Certainly that's what the mysql test > client (no Python involved) does when I try this (on a random table > I've got lying around). > > Or was the question about the connect() call? I thought it was about > the SELECT statement. (They both have a 'conrad'.) I was working on the assumption that Conrad meant 'there is no row containing data "conrad"'. Of course, the SQL statement is a bit botched, so this IS going to raise an exception :) Conrad: I think you meant "SELECT * FROM users WHERE username='conrad'", or something like that. -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From guido at python.org Mon Oct 6 18:45:04 2003 From: guido at python.org (Guido van Rossum) Date: Mon Oct 6 18:50:32 2003 Subject: [DB-SIG] None Value?? In-Reply-To: Your message of "Mon, 06 Oct 2003 15:33:11 PDT." <11243981-F84D-11D7-8C4A-000A95E3823E@cogdon.org> References: <11243981-F84D-11D7-8C4A-000A95E3823E@cogdon.org> Message-ID: <200310062245.h96Mj4B21028@12-236-54-216.client.attbi.com> > On Monday, Oct 6, 2003, at 15:24 US/Pacific, Conrad Koziol wrote: > > > Hey what does MySQLdb return if it cant find the value. Like in the > > code > > below, what if conrad does not exist in the table users, what would > > result equal? > > > > db = MySQL.connect(host='localhost, user='conrad', passwd='python', > > db='general') > > cursor = db.cursor() > > cursor.execute('SELECT conrad FROM users') > > result = cursor.fetchall() [Chris Cogdon] > fetchall, in this instance, will return an empty list. > > if you run 'fetchone' when there are no, or no more, results, it > returns None. Hm. I'd think that if the table 'users' has no column 'conrad', this would raise an exception saying approximately "ERROR 1054: Unknown column 'foo' in 'field list'". Certainly that's what the mysql test client (no Python involved) does when I try this (on a random table I've got lying around). Or was the question about the connect() call? I thought it was about the SELECT statement. (They both have a 'conrad'.) --Guido van Rossum (home page: http://www.python.org/~guido/) From gbrunet at sempersoft.com Tue Oct 7 22:50:14 2003 From: gbrunet at sempersoft.com (Greg Brunet) Date: Tue Oct 7 22:50:28 2003 Subject: [DB-SIG] [adodbapi] Creating MS Access DB Message-ID: Is there a way to create a new MS Access DB on Windows using [adodbapi] ? If not, is there any other tool or module that I can use to do this? Thanks, -- Greg From bgudorf at neurokode.com Tue Oct 7 23:31:28 2003 From: bgudorf at neurokode.com (Bryan J Gudorf) Date: Tue Oct 7 23:31:32 2003 Subject: [DB-SIG] Python Database Objects (PDO) 1.0.2 Released Message-ID: Hey Guys, just wanted to announce another revision release of PDO. We have released PDO 1.0.2 which now includes kinterbasedb support. http://pdo.neurokode.com Bryan J Gudorf NeuroKode Labs, LLC From hekelund at hotmail.com Wed Oct 8 04:27:43 2003 From: hekelund at hotmail.com (xHenrik Ekelund) Date: Wed Oct 8 04:27:48 2003 Subject: [DB-SIG] [adodbapi] Creating MS Access DB Message-ID: No I don't think you can create a new Access database with adodbapi (or ODBC or whatever), because the Jet engine does not have a CREATE DATABASE statement. The easiest way to do it is of to course to use Access to create a new database file. But I would definitely recommend to use the MSDE engine that is included with Access (also called Access Database Project) instead. It is a scaled down version of SQL Server which is much better than Jet. MSDE understands the Transact-SQL language, which has a CREATE DATABASE statement, so I believe it is possible to use MSDE to create new databases. Good Luck, Henrik Ekelund >From: "Greg Brunet" >To: db-sig@python.org >Subject: [DB-SIG] [adodbapi] Creating MS Access DB >Date: Tue, 7 Oct 2003 21:50:14 -0500 > >Is there a way to create a new MS Access DB on Windows using [adodbapi] >? If not, is there any other tool or module that I can use to do this? >Thanks, > >-- >Greg > > > >_______________________________________________ >DB-SIG maillist - DB-SIG@python.org >http://mail.python.org/mailman/listinfo/db-sig _________________________________________________________________ Hitta r?tt k?pare p? MSN K?p & S?lj http://www.msn.se/koposalj From msanchez at grupoburke.com Wed Oct 8 09:24:18 2003 From: msanchez at grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: Wed Oct 8 09:24:35 2003 Subject: [DB-SIG] [adodbapi] Creating MS Access DB In-Reply-To: References: Message-ID: <1065619457.974.5.camel@renata.macondo.pri> The simplest way is to copy an empty model database file (mdb). It is rather kludgy, but useful. El mi?, 08-10-2003 a las 04:50, Greg Brunet escribi?: > Is there a way to create a new MS Access DB on Windows using [adodbapi] > ? If not, is there any other tool or module that I can use to do this? > Thanks, -- Marcos S?nchez Provencio www.burke.es From gbrunet at sempersoft.com Wed Oct 8 12:38:16 2003 From: gbrunet at sempersoft.com (Greg Brunet) Date: Wed Oct 8 12:38:26 2003 Subject: [DB-SIG] Re: [adodbapi] Creating MS Access DB References: Message-ID: Thanks for the responses to my question. I do have an "empty.mdb" that I do use, and that works fine, but wanted to see if I wasn't overlooking anything. I also agree that MSDE is a much better overall solution, and have migrated to that where-ever possible. Thanks again, -- Greg From bwalling at coastdental.com Wed Oct 8 15:04:24 2003 From: bwalling at coastdental.com (Benjamin Walling) Date: Wed Oct 8 15:04:47 2003 Subject: [DB-SIG] [adodbapi] Creating MS Access DB Message-ID: <61119D047A3FE84E83EF2FFDA9A156A4E58F7F@cstntexch01.coastdental.lan> You could use ADOX. -----Original Message----- From: Marcos S?nchez Provencio [mailto:msanchez@grupoburke.com] Sent: Wednesday, October 08, 2003 9:24 AM To: Greg Brunet Cc: db-sig@python.org Subject: Re: [DB-SIG] [adodbapi] Creating MS Access DB The simplest way is to copy an empty model database file (mdb). It is rather kludgy, but useful. El mi?, 08-10-2003 a las 04:50, Greg Brunet escribi?: > Is there a way to create a new MS Access DB on Windows using > [adodbapi] ? If not, is there any other tool or module that I can use to do this? > Thanks, -- Marcos S?nchez Provencio www.burke.es _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig From zen at shangri-la.dropbear.id.au Thu Oct 9 04:39:48 2003 From: zen at shangri-la.dropbear.id.au (Stuart Bishop) Date: Thu Oct 9 04:43:37 2003 Subject: [DB-SIG] Date/Time confusion in spec Message-ID: <2415A594-FA34-11D7-8EE5-000A95A06FC6@shangri-la.dropbear.id.au> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. The DBAPI 2.0 spec does not mention if the parameters to the Date(), Time() or Timestamp() constructors wants times in the local time zone, in UTC, or a naive time. DateFromTicks(), TimeFromTicks() and TimestampFromTicks() use epoch time, which is UTC. This seems an important point. If Timestamp() wants UTC or local time, it is all unambiguous if we know which. If Timestamp() is timezone naive, then either the backend needs to be able to support both naive and TZ aware timestamps, or the *FromTicks() constructors need to convert the ticks to the local time zone. Does this sound correct? Currently there are constructors for creating DATETIME objects. However, there is no way of converting back into some known format. So although I can insert timestamps into a database without knowing about the drivers particular DATETIME implementation (mxDateTime? Python datetime? An ISO8601 string?), I can't retrieve and process them. A sane way of addressing this would be another constructor be added to the API, taking a driver specific DATETIME and returning something known (eg. epoch time or a tuple as per the standard time module). - -- Stuart Bishop http://www.stuartbishop.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (Darwin) iD8DBQE/hR7YAfqZj7rGN0oRAqKUAKCEKlYbmAH+SmBV5qncCrARzzD3rgCggnIz tDjZc/2K3+zh25XowH/po/c= =d2Pi -----END PGP SIGNATURE----- From mal at lemburg.com Thu Oct 9 05:01:04 2003 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Oct 9 05:01:09 2003 Subject: [DB-SIG] Date/Time confusion in spec In-Reply-To: <2415A594-FA34-11D7-8EE5-000A95A06FC6@shangri-la.dropbear.id.au> References: <2415A594-FA34-11D7-8EE5-000A95A06FC6@shangri-la.dropbear.id.au> Message-ID: <3F8523D0.9080101@lemburg.com> Stuart Bishop wrote: > Hi. > > The DBAPI 2.0 spec does not mention if the parameters to > the Date(), Time() or Timestamp() constructors wants times > in the local time zone, in UTC, or a naive time. Right, because this depends on what the program and/or database uses as time zone. It's an application scope issue, not an interface issue. > DateFromTicks(), TimeFromTicks() and TimestampFromTicks() > use epoch time, which is UTC. There's no correspondence between epoch time and a time zone such as UTC. You are right in that the spec is unclear at this point. It does not say which time zone should be used when converting the ticks value to a date/time value. Traditionally, though, this has always been the local time zone. Perhaps we should make that explicit in the spec ?! > This seems an important point. If Timestamp() wants UTC or local > time, it is all unambiguous if we know which. If Timestamp() is > timezone naive, then either the backend needs to be able to support > both naive and TZ aware timestamps, or the *FromTicks() constructors > need to convert the ticks to the local time zone. Does this sound > correct? Yes. > Currently there are constructors for creating DATETIME objects. > However, there is no way of converting back into some known format. > So although I can insert timestamps into a database without knowing > about the drivers particular DATETIME implementation (mxDateTime? > Python datetime? An ISO8601 string?), I can't retrieve and process > them. > > A sane way of addressing this would be another constructor be added > to the API, taking a driver specific DATETIME and returning something > known (eg. epoch time or a tuple as per the standard time module). Well, all formats can be converted to strings and you can then take it from there, but I agree that the situation is not all that clear. The problem with this is that you really don't want to have to fiddle with all rows in a result set just to get them to use known data types. I'm using a special attribute in mxODBC to let the user set the data type that he wants to see for date/time values. That's usually more practical than having to filter all result sets... _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Oct 09 2003) >> Python/Zope Products & Consulting ... http://www.egenix.com/ >> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zen at shangri-la.dropbear.id.au Thu Oct 9 06:36:31 2003 From: zen at shangri-la.dropbear.id.au (Stuart Bishop) Date: Thu Oct 9 06:37:00 2003 Subject: [DB-SIG] Date/Time confusion in spec In-Reply-To: <3F8523D0.9080101@lemburg.com> Message-ID: <7298E1FD-FA44-11D7-8EE5-000A95A06FC6@shangri-la.dropbear.id.au> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, October 9, 2003, at 07:01 PM, M.-A. Lemburg wrote: > Stuart Bishop wrote: >> The DBAPI 2.0 spec does not mention if the parameters to >> the Date(), Time() or Timestamp() constructors wants times >> in the local time zone, in UTC, or a naive time. > > Right, because this depends on what the program and/or > database uses as time zone. It's an application scope > issue, not an interface issue. > >> DateFromTicks(), TimeFromTicks() and TimestampFromTicks() >> use epoch time, which is UTC. > > There's no correspondence between epoch time and a time zone > such as UTC. You are right in that the spec is unclear at > this point. It does not say which time zone should be used > when converting the ticks value to a date/time value. According to the Python Reference guide (which is where the DB API spec says its definition is), epoch time is UTC. It defines the start of the epoch as time.gmtime(0). And if TimeFromTicks() is local time, then Timestamp(1970,1,1) != TimestampFromTicks(0) unless TZ=UTC Which mirrors gmtime(0) != localtime(0) unless TZ=UTC If this is not the way existing drivers have been implemented, then we will need to change the definition of ticks being used. > Traditionally, though, this has always been the local time > zone. Perhaps we should make that explicit in the spec ?! +1 >> A sane way of addressing this would be another constructor be added >> to the API, taking a driver specific DATETIME and returning something >> known (eg. epoch time or a tuple as per the standard time module). > > Well, all formats can be converted to strings and you can > then take it from there, but I agree that the situation is > not all that clear. This looks promising - thankfully both mxDateTime and the Python 2.3 datetime module use the same string representation so this is fine. Anyone know if there are any drivers that have a different string representation (yyyy-mm-dd hh:mi:ss.ssssss)? If none, it would be good if this could be made explicit too. > The problem with this is that you really don't want to > have to fiddle with all rows in a result set just to get > them to use known data types. I'm using a special attribute > in mxODBC to let the user set the data type that he wants > to see for date/time values. That's usually more practical > than having to filter all result sets... I'm adding tests to my DB API 2.0 compliance test suite, so practicality is unnecessary in my case :-) - -- Stuart Bishop http://www.stuartbishop.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (Darwin) iD8DBQE/hTo3AfqZj7rGN0oRAuJQAJ4gdlWoNT8+iwmzT0xCLNEzBkvcKgCgkDO8 k6P4GeNOsJ37BSAnbE/hRQ8= =e9Kf -----END PGP SIGNATURE----- From mal at lemburg.com Thu Oct 9 07:14:53 2003 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Oct 9 07:14:58 2003 Subject: [DB-SIG] Date/Time confusion in spec In-Reply-To: <7298E1FD-FA44-11D7-8EE5-000A95A06FC6@shangri-la.dropbear.id.au> References: <7298E1FD-FA44-11D7-8EE5-000A95A06FC6@shangri-la.dropbear.id.au> Message-ID: <3F85432D.9010300@lemburg.com> Stuart Bishop wrote: > On Thursday, October 9, 2003, at 07:01 PM, M.-A. Lemburg wrote: > >> Stuart Bishop wrote: >> >>> The DBAPI 2.0 spec does not mention if the parameters to >>> the Date(), Time() or Timestamp() constructors wants times >>> in the local time zone, in UTC, or a naive time. >> >> >> Right, because this depends on what the program and/or >> database uses as time zone. It's an application scope >> issue, not an interface issue. >> >>> DateFromTicks(), TimeFromTicks() and TimestampFromTicks() >>> use epoch time, which is UTC. >> >> There's no correspondence between epoch time and a time zone >> such as UTC. You are right in that the spec is unclear at >> this point. It does not say which time zone should be used >> when converting the ticks value to a date/time value. > > According to the Python Reference guide (which is where the DB API > spec says its definition is), epoch time is UTC. It defines the > start of the epoch as time.gmtime(0). The ticks value itself is based on UTC, but when converting from and to ticks, the time zone you are worried about is the one that is used in the conversion, not the one that happens to be used for the definition of the underlying value. So, agreed, ticks do refer to UTC and the epoch is also defined in terms of UTC, but the user is usually not interested in that detail, but rather in what time zone is being used by whatever mechanism is using ticks for calculation or representation purposes. That said, it's always better to store date/time values as UTC in a database, since it avoids all the time zone confusion that local time introduces. > And if TimeFromTicks() is local time, then > Timestamp(1970,1,1) != TimestampFromTicks(0) unless TZ=UTC > > Which mirrors gmtime(0) != localtime(0) unless TZ=UTC > > If this is not the way existing drivers have been implemented, then > we will need to change the definition of ticks being used. > >> Traditionally, though, this has always been the local time >> zone. Perhaps we should make that explicit in the spec ?! > > +1 > >>> A sane way of addressing this would be another constructor be added >>> to the API, taking a driver specific DATETIME and returning something >>> known (eg. epoch time or a tuple as per the standard time module). >> >> >> Well, all formats can be converted to strings and you can >> then take it from there, but I agree that the situation is >> not all that clear. > > This looks promising - thankfully both mxDateTime and the Python 2.3 > datetime module use the same string representation so this is fine. > Anyone know if there are any drivers that have a different string > representation (yyyy-mm-dd hh:mi:ss.ssssss)? If none, it would be > good if this could be made explicit too. > >> The problem with this is that you really don't want to >> have to fiddle with all rows in a result set just to get >> them to use known data types. I'm using a special attribute >> in mxODBC to let the user set the data type that he wants >> to see for date/time values. That's usually more practical >> than having to filter all result sets... > > I'm adding tests to my DB API 2.0 compliance test suite, so > practicality is unnecessary in my case :-) In that case I'd just you the ISO string representation to check date/time values (forget about the seconds fraction, BTW, these are highly non-portable between DB backends). _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Oct 09 2003) >> Python/Zope Products & Consulting ... http://www.egenix.com/ >> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From lac at strakt.com Mon Oct 13 09:17:25 2003 From: lac at strakt.com (Laura Creighton) Date: Mon Oct 13 09:17:42 2003 Subject: [DB-SIG] Re: [EuroPython] Python and Database In-Reply-To: Message from "Noelle QUEMENER" of "Mon, 13 Oct 2003 14:54:56 +0200." References: Message-ID: <200310131317.h9DDHPh9016249@ratthing-b246.strakt.com> This is a great question, but you are in the wrong place. We are planning the European Python conference here, to be held the second week of June in Gothenburg, Sweden. I would like to invite you, and hope you have a very good time. In the meantime, there is a place for questions like yours, which I cannot answer, the db-sig@python.org I have forwarded your mail there. I have also forwarded it to Duncan Grisby, duncan@grisby.org because unless I misunderstood a talk he gave at Python-UK he has already done something similar to what you want to do. Now I will stop being helpful, but do come to EuroPython! Laura Creighton In a message of Mon, 13 Oct 2003 14:54:56 +0200, "Noelle QUEMENER" writes: >Hi, > >I am working on a new project which aim is >- to centralise data in an Oracle Database, >- to do some calculations (based on models), >- to visualize these data on diverse client PC (heavy clients). >The OS environnement is Unix. > >The context of the system is >- in case of crash the user mustn't lose his context and can work in a >degraded mode >- high transparency to failures >- high availability of the system (10 minutes allowed between 7h and 14h >- >1 minute allowed between 14h and 15h30 >and less than 1minute between 15h30 and 16h30) > >The techical architecture is not yet chosen but experts advise us to use >a >Cluster Weblogic application server combined to a Cluster >version of Oracle and java developement on the clients (heavy clients) >What I know is that java is not a performant tehnology in terms of speed >of >execution and Cluster softwares are extremely expensive. >I discovered Python not so long ago and to what I saw it is surprising ho >w >compact/performant it is and how easy it is to use. I would like to >propose Python by I have no argument to support my suggestion. Can someon >e >help me? >My further questions are: >- we don't want users to connect directy to the database but we want them >to use an interface. Can such an interface be deployed in Python, >knowing our time constraints? >- as we want a high availability of the whole system what kind of solutio >n >could we use? > >Thanks, >Noelle Quemener > > > >_______________________________________________ >EuroPython mailing list >EuroPython@python.org >http://mail.python.org/mailman/listinfo/europython From Rick.Brown at bwaycorp.com Tue Oct 14 13:30:20 2003 From: Rick.Brown at bwaycorp.com (Rick Brown) Date: Tue Oct 14 13:32:05 2003 Subject: [DB-SIG] informixdb module on python 2.2? Message-ID: From Rick.Brown at bwaycorp.com Wed Oct 15 12:36:43 2003 From: Rick.Brown at bwaycorp.com (Rick Brown) Date: Wed Oct 15 12:38:18 2003 Subject: [DB-SIG] informixdb module on python 2.2? Message-ID: Hello Python DB Experts! If anyone can help with this I will very much appreciate it! We're interested in using python at work to connect to one of our informix databases. Unfortunately, we're having trouble compiling the informixdb-1.3 module under python 2.2? It seems the absence of makefile.pre.in in python 2.2 causes the break under py2.2. Is there an easy way around this. I've heard rumors of a manual method, but have been unable to track down details. Again, any help is very much appreciated! Thanks in advance, Mike Mike, I'm having a configure problem also with the 2.3.2 -- did you get an answer for the above question?? Please forward!! Thanks rick From dbsig at evpopov.com Thu Oct 16 04:49:59 2003 From: dbsig at evpopov.com (dbsig) Date: Thu Oct 16 04:50:04 2003 Subject: [DB-SIG] pb in connect call with cx_Oracle Message-ID: <1066294199.3f8e5bb735be3@imp.online.net> Hi, When calling cx_Oracle.connect(), I get the exception: "RuntimeError: Unable to acquire Oracle environment handle" Does anyone know what this error mean ? I'm a total newbie regarding Oracle management (I've just installed it for the first time and tried to connect with Python), so that may be a stupid thing I did / didn't do. Connecting to my database with the console enterprise manager do work, however. Also, I started all the Oracle services I could, in case it would help (but it didn't)... I'm using cx_Oracle V3.1, Oracle personal edition V9.2.0.1.0 with server and client tools installed. From andy47 at halfcooked.com Thu Oct 16 06:03:12 2003 From: andy47 at halfcooked.com (Andy Todd) Date: Thu Oct 16 06:04:45 2003 Subject: [DB-SIG] pb in connect call with cx_Oracle In-Reply-To: <1066294199.3f8e5bb735be3@imp.online.net> References: <1066294199.3f8e5bb735be3@imp.online.net> Message-ID: <3F8E6CE0.10903@halfcooked.com> dbsig wrote: > Hi, > > When calling cx_Oracle.connect(), I get the exception: > > "RuntimeError: Unable to acquire Oracle environment handle" > > Does anyone know what this error mean ? I'm a total newbie regarding Oracle > management (I've just installed it for the first time and tried to connect with > Python), so that may be a stupid thing I did / didn't do. Connecting to my > database with the console enterprise manager do work, however. Also, I started > all the Oracle services I could, in case it would help (but it didn't)... > > I'm using cx_Oracle V3.1, Oracle personal edition V9.2.0.1.0 with server and > client tools installed. > I'm presuming that you are working on Windows (presumably Windows 2000 or XP). Firstly you need to check that your Oracle set up is working correctly. If you open a DOS window and type 'sqlplus' what happens? Does the tool start? And can you then connect to your database? If you can connect can you run any queries? Can you connect to your database using an alias? That is, instead of just specifying username/password as your connect string you specify username/password@dbname. If the answers to all of these questions are yes, then your Oracle database is probably set up correctly. Then can we look at your cx_Oracle problems. It would probably help if you include some lines from a interactive Python session showing what you type and the errors you are seeing in context. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From dbsig at evpopov.com Thu Oct 16 11:28:52 2003 From: dbsig at evpopov.com (dbsig) Date: Thu Oct 16 11:28:58 2003 Subject: [DB-SIG] pb in connect call with cx_Oracle In-Reply-To: <3F8E9897.1070807@halfcooked.com> References: <1066294199.3f8e5bb735be3@imp.online.net> <3F8E6CE0.10903@halfcooked.com> <1066308099.3f8e920399299@imp.online.net> <3F8E9897.1070807@halfcooked.com> Message-ID: <1066318132.3f8eb93484ae8@imp.online.net> > > > > Note also that I had to copy the oci.dll from the ora92\bin directory into > > > python\Lib\site-packages (where cx_Oracle.pyd is), else the 'import > cx_Oracle' > > fails (on this dll missing). > > A-ha! You need more than the oci.dll to connect to Oracle. Add the > Oracle 'bin' directory to your path and you should be working (mine is > C:\Oracle\Ora92\bin for instance). I'd also get rid of the copy of the > dll from your site packages directory once you've done that. Thanks Andy, that was the reason why it didn't work ! From anthony at interlink.com.au Sun Oct 19 23:14:31 2003 From: anthony at interlink.com.au (Anthony Baxter) Date: Sun Oct 19 23:17:01 2003 Subject: [DB-SIG] fakedb - a stub database for unit testing Message-ID: <200310200314.h9K3EWHb027180@localhost.localdomain> Here's a little toy I've whipped up for a project at work - it pretends to be a database connection, but records the (parsed) SQL that was fed to it. It also uses the parsed SQL to produce a valid cursor.description after a select - note, though, that it never returns any rows. It needs gadfly for the SQL parsing - this seemed to be the only available SQL parser for python, and writing my own was way too much work. Anyway, here 'tis, feel free to do with it what you will. Any suggestions for improvements are more than welcome. Anthony #------------------start fakedb.py-------------------- class FakeDBCursor(object): "Fake up enough stuff to get away with it ;)" def __init__(self): self.SQLs = [] def execute(self, sql): from sqlparse import SQLParse dqltype, res = SQLParse(sql) if dqltype != 'Selector': self.description = () else: self.description = [] columns = res[1] for name, boundattr in columns.order: if name is not None: self.description.append((name, 0,0,0,0,0,0)) else: self.description.append((boundattr.name, 0,0,0,0,0,0)) self.description = tuple(self.description) self.SQLs.append((sql, (dqltype,res))) return None def fetchone(self): return None def fetchmany(self): return [] def fetchall(self): return [] class FakeDBConnection(FakeDBCursor): def cursor(self): return FakeDBCursor() def commit(self): return None def rollback(self): return None def Connect(*args, **kwargs): return FakeDBConnection() try: import gadfly except ImportError: gadfly = None def SQLParse(sqltext): if gadfly is None: return None, None from gadfly import sql, bindings sql = sql.getSQL() bind = bindings.BindRules(sql) from gadfly.semantics import Parse_Context context = Parse_Context() cs = sql.DoParse1(sqltext, context) return cs[0].__class__.__name__, cs[0].initargs() #--------------------end fakedb.py-------------------- From joe at bar-s.com Wed Oct 22 01:35:36 2003 From: joe at bar-s.com (jgoldtest) Date: Wed Oct 22 01:36:12 2003 Subject: [DB-SIG] Examples on how to use mxODBC? Message-ID: Hi all, I've got to appologize for posting what must be a stupid question but so far, I've been unable to figure it out for myself. I'm trying to learn web development using python. I've tried out Zope, Twisted, and finally Cherrypy. I work at a Microsoft shop but I'm trying go get them away from .Net and into open source. I figure if I can learn it, I can make it easy for everyone else by teaching it. I may have taken on too much. The learning curve is steep! I've taken a break from the Web stuff for a bit to try and figure out how to access my database. Ideally, I'd just like a few lines to show what you need to import, what objects and methods need to be executed to connect to a database and execute a select statement. I guess I'd also be nice if it could read through the returned records. I'm sure this is a really simple thing to do but I can't find any working examples. I can find examples for accessing MySQL but I don't know how to convert them to mx ODBC. I've tried a number of things but nothing seems to work. I've found old examples that use the ODBC 1.0 spec and start with lines like "from calldll import odbc" but I can't find this "calldll" package. It's all very confusing. I downloaded and installed the mx ODBC. I guess the documentation is good if you already know what you're doing but it's been pretty useless to me. There are NO example programs that I can find that demonstrate step-by-step how you use it. Anyway, a few pointers would be helpful. I'll try not to be a pest. Joe Goldthwaite Phoenix, AZ Property of Bar-S Foods. This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately at 602.264.7272 or postmaster@bar-s.com. From mal at lemburg.com Wed Oct 22 04:38:03 2003 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Oct 22 04:38:09 2003 Subject: [DB-SIG] Examples on how to use mxODBC? In-Reply-To: References: Message-ID: <3F9641EB.2070105@lemburg.com> jgoldtest wrote: > Hi all, > > I've got to appologize for posting what must be a stupid question but so far, I've been unable to figure it out for myself. I'm trying to learn web development using python. I've tried out Zope, Twisted, and finally Cherrypy. I work at a Microsoft shop but I'm trying go get them away from .Net and into open source. I figure if I can learn it, I can make it easy for everyone else by teaching it. I may have taken on too much. The learning curve is steep! > > I've taken a break from the Web stuff for a bit to try and figure out how to access my database. Ideally, I'd just like a few lines to show what you need to import, what objects and methods need to be executed to connect to a database and execute a select statement. I guess I'd also be nice if it could read through the returned records. I'm sure this is a really simple thing to do but I can't find any working examples. I can find examples for accessing MySQL but I don't know how to convert them to mx ODBC. I've tried a number of things but nothing seems to work. > > I've found old examples that use the ODBC 1.0 spec and start with lines like "from calldll import odbc" but I can't find this "calldll" package. It's all very confusing. I downloaded and installed the mx ODBC. I guess the documentation is good if you already know what you're doing but it's been pretty useless to me. There are NO example programs that I can find that demonstrate step-by-step how you use it. > > Anyway, a few pointers would be helpful. I'll try not to be a pest. Some links that may help: http://www.python.org/topics/database/docs.html http://www.egenix.com/Python-Database-API-Talk.pdf I'd suggest to buy one of the fine Python books out there. They usually have good introductions to the DB-API and how to use it. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Oct 22 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From andy47 at halfcooked.com Wed Oct 22 04:53:21 2003 From: andy47 at halfcooked.com (Andy Todd) Date: Wed Oct 22 04:55:32 2003 Subject: [DB-SIG] Examples on how to use mxODBC? In-Reply-To: References: Message-ID: <3F964581.6090905@halfcooked.com> jgoldtest wrote: > Hi all, > > I've got to appologize for posting what must be a stupid question but so far, I've been unable to figure it out for myself. I'm trying to learn web development using python. I've tried out Zope, Twisted, and finally Cherrypy. I work at a Microsoft shop but I'm trying go get them away from .Net and into open source. I figure if I can learn it, I can make it easy for everyone else by teaching it. I may have taken on too much. The learning curve is steep! > > I've taken a break from the Web stuff for a bit to try and figure out how to access my database. Ideally, I'd just like a few lines to show what you need to import, what objects and methods need to be executed to connect to a database and execute a select statement. I guess I'd also be nice if it could read through the returned records. I'm sure this is a really simple thing to do but I can't find any working examples. I can find examples for accessing MySQL but I don't know how to convert them to mx ODBC. I've tried a number of things but nothing seems to work. > > I've found old examples that use the ODBC 1.0 spec and start with lines like "from calldll import odbc" but I can't find this "calldll" package. It's all very confusing. I downloaded and installed the mx ODBC. I guess the documentation is good if you already know what you're doing but it's been pretty useless to me. There are NO example programs that I can find that demonstrate step-by-step how you use it. > > Anyway, a few pointers would be helpful. I'll try not to be a pest. > > Joe Goldthwaite > Phoenix, AZ > > > Property of Bar-S Foods. This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately at 602.264.7272 or postmaster@bar-s.com. > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig Joe, First, a couple of assumptions. As you are a 'Microsoft shop' I'm assuming that you know all about DSNs and have one configured for the database you want to access. I'm also assuming that you know a little SQL and that you have successfully installed Python and the mx utilities. Oh, and that you are running on some flavour of Windows (I'm assuming 2000 or XP but this should work with other versions). Given that, fire up your Python interpreter and try; >>> db=ODBC.Windows.connect('') >>> This will create a connection object (referenced by 'db') to your database. Once you've got a connection, most of the work is done through a cursor; >>> myCursor=db.cursor() >>> Which creates a cursor object which you can reference through 'myCursor'. Then, you will probably want to execute a select statement. This is achieved in two parts, executing the statement; >>> myCursor.execute('') >>> And getting the results. There are a number 'fetch' methods available to you, here is just one (read the DB-API specification http://www.python.org/peps/pep-0249.html); >>> firstRow=myCursor.fetchone() This will return the first row from your select statement into a tuple which can be referenced by 'firstRow'. To see what's in it just try; >>> firstRow ('', '', ... ) You can then merrily keep calling 'fetchone' until the cursor runs out of rows to return. The only other things to note about mxODBC is that it uses the standard ODBC convention of using '?' in a SQL statement to mark a parameter. This is the qmark paramstyle from the DB-API 2.0 specification. This allows you to specify a value in your query at run time rather than when you write the code. An example of this (using my database) is; >>> stmt="SELECT currency_symbol, country_code FROM currencies WHERE currency_code=?" >>> myCursor.execute(stmt, ('UKP',)) That should get you started. The first rule of Python applies - the interpreter is interactive, and if you are using the rather marvelous Pythonwin then tooltips are an incredibly useful tool for investigating the program space, particularly which attributes and methods are available on the objects you have. I'd also recommend taking a look at the mxODBC documentation, which is well written, clear, concise and complete. Its available here; http://www.egenix.com/files/python/mxODBC.html Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From wnvcole at peppermillcas.com Wed Oct 22 10:47:33 2003 From: wnvcole at peppermillcas.com (Vernon Cole) Date: Wed Oct 22 10:47:39 2003 Subject: [DB-SIG] Examples on how to use mxODBC? Message-ID: <07AF3C77A0FBD311A99F00508B65203903272B81@sebastian.peppermillcas.com> -----Original Message----- From: jgoldtest [mailto:joe@bar-s.com] Sent: Tuesday, October 21, 2003 11:36 PM To: db-sig@python.org Subject: [DB-SIG] Examples on how to use mxODBC? Hi all, I've got to appologize for posting what must be a stupid question but so far, I've been unable to figure it out for myself. I'm trying to learn web development using python. I've tried out Zope, Twisted, and finally Cherrypy. I work at a Microsoft shop but I'm trying go get them away from .Net and into open source. I figure if I can learn it, I can make it easy for everyone else by teaching it. I may have taken on too much. The learning curve is steep! I've taken a break from the Web stuff for a bit to try and figure out how to access my database. Ideally, I'd just like a few lines to show what you need to import, what objects and methods need to be executed to connect to a database and execute a select statement. I guess I'd also be nice if it could read through the returned records. I'm sure this is a really simple thing to do but I can't find any working examples. I can find examples for accessing MySQL but I don't know how to convert them to mx ODBC. I've tried a number of things but nothing seems to work. I've found old examples that use the ODBC 1.0 spec and start with lines like "from calldll import odbc" but I can't find this "calldll" package. It's all very confusing. I downloaded and installed the mx ODBC. I guess the documentation is good if you already know what you're doing but it's been pretty useless to me. There are NO example programs that I can find that demonstrate step-by-step how you use it. Anyway, a few pointers would be helpful. I'll try not to be a pest. Joe Goldthwaite Phoenix, AZ Property of Bar-S Foods. This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately at 602.264.7272 or postmaster@bar-s.com. _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig From wnvcole at peppermillcas.com Wed Oct 22 11:51:18 2003 From: wnvcole at peppermillcas.com (Vernon Cole) Date: Wed Oct 22 11:51:24 2003 Subject: [DB-SIG] Examples on how to use mxODBC? Message-ID: <07AF3C77A0FBD311A99F00508B65203903272B82@sebastian.peppermillcas.com> Everyone: Sorry about that last message! MS Outlook burped and sent it before I could edit anything! I also work in a shop where Microsoft predominates. I dislike the mailer, along with many other things. I also perceive python as a subtle way of loosening MS's grip on our shop. Joe: If you are trying to go open source, then mxODBC may not be your best choice, since it is proprietary. I am only a little bit ahead of you on that steep learning curve, but I have concluded that mxODBC would be too expen$ive for my organization to approve. I have successfully used two different database API's on windows 2000 workstation to access SQL2000 databases. The first is bundeled with the Pythonwin package (http://starship.python.net) and uses ODBC. vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv import dbi, odbc """This program will list the JackPot/Fill locations for all Booths and Windows which exist in the database.""" #the connection string is the DSN/username/password ConnS2 = r"Oasis Data/cdsaccess/xxxxxxxxx" Cdb = odbc.odbc(ConnS2) c2 = Cdb.cursor() s = "select description from GEN_Casino" c2.execute(s) Casino_Name = c2.fetchone()[0] print print 'Unassigned JF_workstations in Casino=', Casino_Name s = """select Booth_id, window from jf_workstation where WorkStation_Id = -1 order by booth_id, window""" c2.execute(s) for rec in c2.fetchall(): print(rec) c2.close() Cdb.close() try: s = dir(pywin) except NameError: s = raw_input('Hit to close window...') print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I needed a way to access sevaral databases, all with the same name, on different servers, so ODBC was not ideal. ADO seemed to be the answer. I found adodbapi on sourceforge.net and tried that. The results were good. Here is a sample which opens a table using "integrated security." Each row in that table contains the name of another SQL server, each of with is opened using "SQL security". A stored proceedure is called, and its output printed out. (caution -- Email will wrap long lines below. Believe the tab level to detect such.) vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv import adodbapi _computername="NIXON" #or name of computer with SQL Server _databasename="WcMine" #or something else connStrSQLServer = r"Initial Catalog=%s; Data Source=%s; Provider=SQLOLEDB.1; Integrated Security=SSPI" %(_databasename, _computername) print connStrSQLServer try: s = adodbapi.connect(connStrSQLServer) cur = s.cursor() cur.execute('select Casino_Code, Description, Server_Name from GEN_Casino') for rec in cur.fetchall(): Casino_Code = str(rec[0]) Description = str(rec[1]) ServerName = str(rec[2]) print Casino_Code, ServerName, Description ConnS2 = r"Initial Catalog=WinOasis; Data Source=%s; Provider=SQLOLEDB.1; User ID=cdsaccess; Password=xxx" %(ServerName) Cdb = adodbapi.connect(ConnS2) c2 = Cdb.cursor() app_id = 1 curUser = 0 LockKey = -1 TaxForm = 2 ret = c2.callproc('CDS_W2G_GET_BYW2G_ID',(0 ,app_id,curUser,LockKey,TaxForm)) print 'ret=', ret for rec2 in c2.fetchall(): print 'rec2=', rec2 except NameError,e: print 'error ', e, 'undefined' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Good luck in your efforts. -------- Vernon -----Original Message----- From: jgoldtest [mailto:joe@bar-s.com] Sent: Tuesday, October 21, 2003 11:36 PM To: db-sig@python.org Subject: [DB-SIG] Examples on how to use mxODBC? Hi all, ... I work at a Microsoft shop but I'm trying go get them away from .Net and into open source. ... From joe at goldthwaites.com Thu Oct 23 19:21:49 2003 From: joe at goldthwaites.com (Goldthwaite, Joe) Date: Thu Oct 23 19:22:00 2003 Subject: [DB-SIG] Examples on how to use mxODBC? In-Reply-To: <3F9641EB.2070105@lemburg.com> Message-ID: <000301c399bc$6fcfb310$6401a8c0@bars.com> Hello again, I was using a jgoldtest@bar-s.com email address since that is what is configured on my python development machine. I forgot that bar-s has a device that appends an annoying "Property of Bar-S Foods.." message at the end of all outgoing email. To get around it, I had to subscribe to a service that allows SSL connections. What a pain. Thanks for the responses from Marc-Andre and Andy Todd. Between the two of you, I got it working. I've actually done a lot of reading. I've gone through the Marc's links and the mxODBC manual (which I see has your Marc's name in the front :)). I've also got The Python Cookbook, Programming Python, Learning Python, Python in a Nutshell, and the Python How To Program on-line training course. With all that, I'm pretty sure I know exactly how it's supposed to work. I know I need to create a connection object with the right parameters. I just couldn't seem to come up with a combination that works. I had tried this; from mx import ODBC connection = ODBC.Connect("BarsFinRpts") And a large number of variations but I couldn't find the object that owns the connect method. Andy Todd provided the last piece; connection = ODBC.Windows.connect("BarsFinRpts") That did it. I was missing the Windows object between the ODBC and the connect(). I knew it was simple. How are you supposed to find this sort of thing? I've gotten used to Visual Studio where you type object. and get a list of the properties and methods. Does Python have anything similar? I've tried using the dir() function to explore the namespace but when I try dir('ODBC') I don't see the Windows object listed. I've also tried the Wing IDE but it just seems to show the generic namespace not the specific methods of the current object. It also doesn't seem to have any function help available. At this point, figuring out HOW to figure out this sort of problem would probably be the best help. Thanks again! I really appreciate the time you guys took to reply. Joe Goldthwaite Phoenix, Arizona. From mal at lemburg.com Fri Oct 24 03:30:15 2003 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Oct 24 03:30:21 2003 Subject: [DB-SIG] Examples on how to use mxODBC? In-Reply-To: <000301c399bc$6fcfb310$6401a8c0@bars.com> References: <000301c399bc$6fcfb310$6401a8c0@bars.com> Message-ID: <3F98D507.8030001@lemburg.com> Goldthwaite, Joe wrote: > Hello again, > > I was using a jgoldtest@bar-s.com email address since that is what is > configured on my python development machine. I forgot that bar-s has a > device that appends an annoying "Property of Bar-S Foods.." message at the > end of all outgoing email. To get around it, I had to subscribe to a > service that allows SSL connections. What a pain. > > Thanks for the responses from Marc-Andre and Andy Todd. Between the two of > you, I got it working. I've actually done a lot of reading. I've gone > through the Marc's links and the mxODBC manual (which I see has your Marc's > name in the front :)). I've also got The Python Cookbook, Programming > Python, Learning Python, Python in a Nutshell, and the Python How To Program > on-line training course. With all that, I'm pretty sure I know exactly how > it's supposed to work. I know I need to create a connection object with the > right parameters. I just couldn't seem to come up with a combination that > works. I had tried this; > > from mx import ODBC > connection = ODBC.Connect("BarsFinRpts") > > And a large number of variations but I couldn't find the object that owns > the connect method. Andy Todd provided the last piece; > > connection = ODBC.Windows.connect("BarsFinRpts") > > That did it. I was missing the Windows object between the ODBC and the > connect(). I knew it was simple. How are you supposed to find this sort of > thing? I've gotten used to Visual Studio where you type object. and get a > list of the properties and methods. Does Python have anything similar? Most Python IDEs do, but Windows in this case is a sub-package of the mx.ODBC package. It is not easily possible to scan for submodules or -packages in Python due to the many ways this can be done. The fact that the above works is due to the LazyModule object we use in mx.ODBC.__init__. Normally, you'd have to write: from mx.ODBC.Windows import DriverConnect conn = DriverConnect('DSN=mydsn;UID=myuid;PWD=mypwd') to get a connection to the database. > I've tried using the dir() function to explore the namespace but when I try > dir('ODBC') I don't see the Windows object listed. I've also tried the Wing > IDE but it just seems to show the generic namespace not the specific methods > of the current object. It also doesn't seem to have any function help > available. > > At this point, figuring out HOW to figure out this sort of problem would > probably be the best help. The mxODBC documentation talks about subpackages and also gives an example, but you're right, it's mostly focussed on describing the details and is missing a tutorial style introduction. > Thanks again! I really appreciate the time you guys took to reply. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Oct 24 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From andy47 at halfcooked.com Fri Oct 24 04:14:42 2003 From: andy47 at halfcooked.com (Andy Todd) Date: Fri Oct 24 04:16:36 2003 Subject: [DB-SIG] Examples on how to use mxODBC? In-Reply-To: <3F98D507.8030001@lemburg.com> References: <000301c399bc$6fcfb310$6401a8c0@bars.com> <3F98D507.8030001@lemburg.com> Message-ID: <3F98DF72.1030607@halfcooked.com> M.-A. Lemburg wrote: > Goldthwaite, Joe wrote: > >> Hello again, >> >> I was using a jgoldtest@bar-s.com email address since that is what is >> configured on my python development machine. I forgot that bar-s has a >> device that appends an annoying "Property of Bar-S Foods.." message at >> the >> end of all outgoing email. To get around it, I had to subscribe to a >> service that allows SSL connections. What a pain. >> >> Thanks for the responses from Marc-Andre and Andy Todd. Between the >> two of >> you, I got it working. I've actually done a lot of reading. I've gone >> through the Marc's links and the mxODBC manual (which I see has your >> Marc's >> name in the front :)). I've also got The Python Cookbook, Programming >> Python, Learning Python, Python in a Nutshell, and the Python How To >> Program >> on-line training course. With all that, I'm pretty sure I know >> exactly how >> it's supposed to work. I know I need to create a connection object >> with the >> right parameters. I just couldn't seem to come up with a combination that >> works. I had tried this; >> >> from mx import ODBC >> connection = ODBC.Connect("BarsFinRpts") >> >> And a large number of variations but I couldn't find the object that owns >> the connect method. Andy Todd provided the last piece; >> >> connection = ODBC.Windows.connect("BarsFinRpts") >> >> That did it. I was missing the Windows object between the ODBC and the >> connect(). I knew it was simple. How are you supposed to find this >> sort of >> thing? I've gotten used to Visual Studio where you type object. and >> get a >> list of the properties and methods. Does Python have anything similar? > > > Most Python IDEs do, but Windows in this case is a sub-package of > the mx.ODBC package. It is not easily possible to scan for submodules > or -packages in Python due to the many ways this can be done. > > The fact that the above works is due to the LazyModule object > we use in mx.ODBC.__init__. Normally, you'd have to write: > > from mx.ODBC.Windows import DriverConnect > conn = DriverConnect('DSN=mydsn;UID=myuid;PWD=mypwd') > > to get a connection to the database. > >> I've tried using the dir() function to explore the namespace but when >> I try >> dir('ODBC') I don't see the Windows object listed. I've also tried >> the Wing >> IDE but it just seems to show the generic namespace not the specific >> methods >> of the current object. It also doesn't seem to have any function help >> available. >> >> At this point, figuring out HOW to figure out this sort of problem would >> probably be the best help. > > > The mxODBC documentation talks about subpackages and also gives > an example, but you're right, it's mostly focussed on describing > the details and is missing a tutorial style introduction. > >> Thanks again! I really appreciate the time you guys took to reply. > > Go and get the Python for Windows extensions (http://sourceforge.net/projects/pywin32/) they include the Pythonwin editor/ide. This gives tooltips and command completion as you are used to in Visual studio. If you want a Python interpreter with nice GUI introspection tools then I can't praise Patrick O'Brien's Py tools highly enough (http://www.orbtech.com/www/PyManual.html). They are shipped as part of the wxPython GUI toolkit (http://www.wxpython.org/). Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From croxton3 at yahoo.com Fri Oct 24 13:16:50 2003 From: croxton3 at yahoo.com (Derek Croxton) Date: Fri Oct 24 13:31:43 2003 Subject: [DB-SIG] PDO and number field Message-ID: I'm getting a strange result when accessing a numeric (identity) field in MySQL with PDO: instead of returning 1 (or 2 or 3, etc.), it returns 1L (or 2L or 3L, etc.). I have no idea where this behaviour is coming from, nor what to do about it. Has anyone else seen this? (Using PDO 1.0.2 and Python 2.3.) Sincerely, Derek Croxton croxton3@yahoo.com From jfranzXREMOVEX at neurokode.com Fri Oct 24 16:43:25 2003 From: jfranzXREMOVEX at neurokode.com (Jon Franz_antispam) Date: Fri Oct 24 16:39:08 2003 Subject: [DB-SIG] PDO and number field Message-ID: <027a01c39a6f$78fd7630$7401a8c0@voidmk9> It appears you are casting the result to a string - so the L is coming from the fact that the data type is a long. This may be a result of the precision used in the MySQL column (MEDIUMINT, BIGINT, etc), or it could be that the underlying mysqldb module is returning a long for some other reason. Anyway - you need the int representation of the string, thus you probably need something like: print "The value is " + str(MyResultSet['myColumn'].value) to work around the issue. This all happens because the repr() version of a long includes the L at the end, but the str() version does not. Have fun, and send any feedback you have on PDO to pythondbo-users@lists.sourceforge.net - we're working on a new version and want to know what users would like to see. ~Jon Franz NeuroKode Labs, LLC -----Original Message----- From: db-sig-bounces@python.org [mailto:db-sig-bounces@python.org]On Behalf Of Derek Croxton Sent: Friday, October 24, 2003 1:17 PM To: db-sig@python.org Subject: [DB-SIG] PDO and number field I'm getting a strange result when accessing a numeric (identity) field in MySQL with PDO: instead of returning 1 (or 2 or 3, etc.), it returns 1L (or 2L or 3L, etc.). I have no idea where this behaviour is coming from, nor what to do about it. Has anyone else seen this? (Using PDO 1.0.2 and Python 2.3.) Sincerely, Derek Croxton croxton3@yahoo.com _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig From steegness at hotmail.com Thu Oct 30 14:52:17 2003 From: steegness at hotmail.com (Sean Steeg) Date: Thu Oct 30 14:52:26 2003 Subject: [DB-SIG] ImportError: cx_Oracle and the missing DLL Message-ID: After putting Google and its search brethern to task for the past few hours, I've decided to come seeking assistance here. I'm attempting to use cx_Oracle for 8i, via the Windows Installer for Python 2.3 found on their website for the task (installing onto Windows NT). The install went smoothly enough (the file ended up in C:\Python23\Lib\site-packages\cx_Oracle.pyd), and I thought I'd be all set. Instead I get the error below, which indicates a failure to find a DLL file, but not which one. Locally, I'm running 8.0.5.0.0 for all my connection/SQLPlus/EasyConfig/etc needs, and 'm trying to connect to an 8.1.6.2.0 8i server, but I doubt the last piece matters, since it's failing on the import. I'm fairly comfortable with python, but not at all with C, DLLs, and the like, so this error is outside of my zone. Might anyone here have some suggestions for tracking down the problem, or better yet, solving it outright? Thanks, Sean ------the error-------- PythonWin 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32. Portions Copyright 1994-2001 Mark Hammond (mhammond@skippinet.com.au) - see 'Help/About PythonWin' for further copyright information. >>>import cx_Oracle Traceback (most recent call last): File "", line 1, in ? ImportError: DLL load failed: The specified procedure could not be found. >>> _________________________________________________________________ Want to check if your PC is virus-infected? Get a FREE computer virus scan online from McAfee. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 From dbsig at evpopov.com Thu Oct 30 15:01:10 2003 From: dbsig at evpopov.com (dbsig) Date: Thu Oct 30 15:01:16 2003 Subject: [DB-SIG] ImportError: cx_Oracle and the missing DLL Message-ID: <1067544070.3fa16e067f056@imp.online.net> You have to put the bin directory of Oracle into your search path (environment variables -> system -> path). Then it should work. From anthony at computronix.com Thu Oct 30 15:08:46 2003 From: anthony at computronix.com (Anthony Tuininga) Date: Thu Oct 30 15:08:58 2003 Subject: [DB-SIG] ImportError: cx_Oracle and the missing DLL In-Reply-To: References: Message-ID: <1067544526.26171.34.camel@localhost.localdomain> The reason you are getting that error is that the version of cx_Oracle that is current only supports Oracle 8.1.x and above. Oracle has long since dropped support for Oracle 8.0.x and so I dropped support for it as well. If you absolutely must continue using 8.0.x with all of its bugs (8.1.7 and 9.2.0 are much more stable) then I can provide you with the source for the last version that supported 8.0.x or I can tell you which source needs to be changed to support 8.0.x. Let me know. Thanks. On Thu, 2003-10-30 at 12:52, Sean Steeg wrote: > After putting Google and its search brethern to task for the past few hours, > I've decided to come seeking assistance here. > > I'm attempting to use cx_Oracle for 8i, via the Windows Installer for Python > 2.3 found on their website for the task (installing onto Windows NT). The > install went smoothly enough (the file ended up in > C:\Python23\Lib\site-packages\cx_Oracle.pyd), and I thought I'd be all set. > Instead I get the error below, which indicates a failure to find a DLL file, > but not which one. > > Locally, I'm running 8.0.5.0.0 for all my connection/SQLPlus/EasyConfig/etc > needs, and 'm trying to connect to an 8.1.6.2.0 8i server, but I doubt the > last piece matters, since it's failing on the import. > > I'm fairly comfortable with python, but not at all with C, DLLs, and the > like, so this error is outside of my zone. Might anyone here have some > suggestions for tracking down the problem, or better yet, solving it > outright? > > Thanks, > Sean > > ------the error-------- > PythonWin 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on > win32. > Portions Copyright 1994-2001 Mark Hammond (mhammond@skippinet.com.au) - see > 'Help/About PythonWin' for further copyright information. > >>>import cx_Oracle > Traceback (most recent call last): > File "", line 1, in ? > ImportError: DLL load failed: The specified procedure could not be found. > >>> > > _________________________________________________________________ > Want to check if your PC is virus-infected? Get a FREE computer virus scan > online from McAfee. > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > _______________________________________________ > 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