Python连接ORACLE数据库的解决记录
2022/6/23 2:21:24
本文主要是介绍Python连接ORACLE数据库的解决记录,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一直在用Python连接内部局域网的ORACLE数据库,通过cx_Oracle模块一直连接不得,直到在百度上查看了相关资料之后,才得;主要步骤:
1、安装cx_Oracle模块:
pip install cx_Oracle
2、将连接oracle数据库的客户端instantclient_11_2中的tnsnames.ora进行配置;\instantclient_11_2\NETWORK\ADMIN目录下的tnsnames.ora;
# tnsnames.ora Network Configuration File: C:\instantclient_11_2\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
server03.world(自定义) =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 服务器IP)(PORT = 服务器端口))
(ADDRESS = (PROTOCOL = TCP)(HOST = 服务器IP)(PORT = 服务器端口))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME=服务器标志名)
)
)
3、将instantclient_11_2中的oci.dll,oraocci11.dll,oraociei11.dll这3个文件拷贝到python的\Anaconda3\Lib\site-packages目录下;
然后测试连接成功,可以进行ORA数据库操作了!!
这篇关于Python连接ORACLE数据库的解决记录的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python
- 2024-03-12python colon equals