import kinterbasdb con=kinterbasdb.connect(dsn='e:/demo/testdata/test.fdb',user='sysdba',password='masterkey') con.text_factory=str cur=con.cursor() i=0 while i<1000: cur.execute('insert into test(name,ordernum) values(?,?)',(unicode('王太','utf-8'),i)) i+=1 con.commit() cur.execute('select first 50 * from test order by id desc') for id,name,ordernum in cur: print id,name,ordernum