JayDeBeApi - JDBC和Python DB API桥


LGPL
跨平台
Java

软件简介

A bridge from JDBC database drivers to Python DB-API.

目前已通过测试的数据库包括 HSQLDB 和 DB2。

示例代码:

>>> import jaydebeapi
>>> conn = jaydebeapi.connect('org.hsqldb.jdbcDriver',
...                           'jdbc:hsqldb:mem', 'SA', '')
>>> curs = conn.cursor()
>>> curs.execute('create table CUSTOMER'
...                '("CUST_ID" INTEGER not null,'
...                ' "NAME" VARCHAR not null,'
...                ' primary key ("CUST_ID"))'
...             )
>>> curs.execute("insert into CUSTOMER values (1, 'John')")
>>> curs.execute("select * from CUSTOMER")
>>> curs.fetchall()
[(1, u'John')]