Python DB API 2.0
3/12
Syntax
pyDB2 module
  • Standardized method of database access from Python applications.
  • Developed by Marc-Andre Lemburg.
  • Very simple interface consisting of two objects and a handful of methods:
  • Connection object -- autocommit is off by default
  • connect() constructor, close() destructor
  • cursor() returns a Cursor object
  • commit() and rollback() for transaction control
  • Cursor object
  • execute(), executemany() SQL statements
  • fetchone(), fetchmany(), fetchall() rows from a result set
  • callproc() for calling stored procedures
  • nextset() for retrieving multiple result sets
  • Two Python modules offer access to Apache Derby:
  • mxODBC: created by Marc-Andre Lemburg, available only under a commercial license
  • pyDB2: created by Man-Yong Lee, available under the LGPL