Database experiences in Python: Good or Bad?

brueckd at brueckd at
Tue Aug 6 16:52:00 CEST 2002

On 5 Aug 2002, Jeff Schedin wrote:

> It seems that the Open Source databases are fine in this area:
> PostgreSQL, MySQL etc  but what about DB2/Oracle/MSSQL?

Of the commercial DBs, I've had good results using DCOracle2 on Linux
(don't know about MSSQL and DB2 always gave me the hives). The biggest
drawback of Oracle is the massive Oracle client installation, although I
got around this by figuring out just the dependencies you really need and
I keep them in a 15 MB tarball (if you want the list of files needed let
me know and I'll post them somewhere). You can also specify the full 
connection string inside of your program instead of editing the 
TNSNAMES.ORA file, further eliminating the client-side setup work.

> Java's JDBC api seems to be well supported by most databases so would
> Jython be a better approach?

I've used this approach in the past too and it also worked well. It has
the huge advantage of needing only the appropriate .jar file to connect to
a given database - no additional client-side install. In terms of Oracle
there's both pure Java versions (slower but cross-platform), and JNI-based
drivers. In either case Jython uses them without problems.

> I mean don't most DBs expose an API which these drivers are then just
> coded against?

Yes and no. Most DBs are accessible via ODBC, but this tends to be slower 
and makes it harder to take advantage of vendor-specific DB features (one 
exception is SAP-DB, where the claim is that the ODBC API *is* their 
native API - neat!). Part of the slowness comes from ODBC just being an 
additional layer on top of the native DB layer, so many Python-DB 
libraries (e.g. DCOracle2 and the MySQL Python extensions) do code against 
the lower level DB API.

Overall the DB support isn't as mature or widely-supported as for, say,
Java, but it's still very usable for production applications.


More information about the Python-list mailing list