Python连接oceanbase数据库
·
import os.path
import sys
import jaydebeapi
url = 'jdbc:oceanbase://10.1.81.76:2883'
user = 'username'
password = 'HundSun@1234!'
driver = 'com.alipay.oceanbase.jdbc.Driver'
currentDir = os.path.abspath(os.path.dirname(sys.argv[0]))
jarFile = os.path.join(currentDir, 'oceanbase-client-2.4.0.jar')
sqlStr = 'select * from student'
conn = jaydebeapi.connect(driver, url, [user, password], jarFile)
curs = conn.cursor()
print(conn)
curs.execute(sqlStr)
result = curs.fetchall()
print(result)
更多推荐

所有评论(0)