#!/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()