准备写一个代码生成的小工具自己用,第一步,连接数据库
import jaydebeapi
url = 'jdbc:oracle:thin:@192.168.0.13:1521:JGD'
user = 'aaaaa'
password = 'xxxxx'
dirver = 'oracle.jdbc.OracleDriver'
jarFile = '/Users/warrior/Code/project/builder/ojdbc6-11.2.0.1.0.jar'
sqlStr = 'select * from T_ERP_MAT_IMGEXG'
conn = jaydebeapi.connect(dirver, url, [user, password], jarFile)
curs = conn.cursor()
curs.execute(sqlStr)
result = curs.fetchall()
print(result)
curs.close()
conn.close()