【笔记】python连接神通数据库

python连接国产神州通用数据库。

一、准备

下载whl及dll:

链接: https://pan.baidu.com/s/1lwE-FwIsf-aYjoqCPij2hA 提取码: 49qp

二、安装

 

目录如上。

1、aci.dll 加入环境变量

2、选择python对应版本,使用pip install xxx.whl 安装工具包。

3、python调用工具库读写神通数据库。

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import STPython

# 连接器
connection = STPython.Connection(
    user='SYSDBA',
    password='szoscar55',
    dsn='localhost:2003/OSRDB'
)
# 游标
cursor = STPython.Cursor(connection)

# 执行SQL
cursor.execute('select * from OFCMS.STUDENT;')

for site_account in cursor.fetchall():
    print(site_account)

# 关闭游标
cursor.close()

  

 

posted @ 2023-01-16 10:59  stagebo  阅读(817)  评论(0编辑  收藏  举报