我今天有很多时间,与大家分享一个最近使用的到第三方控件,个人认为对设计一些数据库测试脚本非常有用。
首先,请访问这个地址:http://www.egenix.com/products/python/mxODBC/,此控件是一个ODBC的通用插件。
这为我们通过Windows系统,制作各种测试脚本提供很好操作平台。DB-API:http://www.python.org/dev/peps/pep-0249/




eGenix.com mx Base Distribution, since the eGenix.com mxODBC Distribution is an add-on to our base set of Python extensions.

licenses or buy production licenses in order to successfully install and use the package.

installation instructions below.


and conditions set forth in the eGenix.com Commercial License Agreement 1.2.0.

details about redistribution possibilities and terms.
下载控件清单:
egenix-mx-base-3.0.0.win32-py2.5.ms
egenix-mx-experimental-3.0.0.win32-py2.5.msiegenix-mxodbc-3.0.1.win32-py2.5.msi
注册License
eGenix.com Commercial License Agreement 1.2.0,注意填好后,Liscense会被发送到邮箱
Lincense拷贝的路径,本机地址:C:\Python25\Lib\site-packages\mx\ODBC
如果没有注册Liscense,会有如下提示:
以下提供一段测试程序,该段程序为清除Db2中的两表数据:










:mx.ODBC.license could not be loaded; please visit
the http://www.egenix.com/ web-site to obtain a license file or write to licenses@egenix.com for information.)



















(self.tablename1))

(self.tablename2))












db = mx.ODBC.Windows.DriverConnect( 'DSN=infospy' ) DSN为在WindowsODBC中配置的数据源名
有关ODBC配置,此贴略。由于时间关系,详细的API请查询文章中所给的地址。