python操做sybase iq数据库

#!/usr/env/bin pythonpython

-*-coding:utf-8 -*-sql

#导入数据库链接模块数据库

import sqlanydbfetch

user='dba'
passwd='hwfx123'
host='localhost:5000'utf-8

_sql = """select getdate()"""get

# 链接到数据库
con = sqlanydb.connect(userid=user, password=passwd, host=host)import

# 执行SQL语句
cur = con.cursor()
cur.execute(_sql)date

# 获取执行结果
current_date = cur.fetchall()[0]coding

print 'current date is', current_dateselect

cur.close()con.close()

相关文章
相关标签/搜索