使用python访问Oracle数据库
2010-11-30 00:09
531 查看
import cx_Oracle import os if False: #当Oracle服务是手动运行时,将False改为True os.system('net start OracleVssWriterORCL') os.system('net start OracleDBConsoleorcl') os.system('net start OracleOraDb11g_home1TNSListener') os.system('net start OracleServiceORCL') orcl = cx_Oracle.connect('system/username@localhost:1521/orcl'.decode('utf8')) cur = orcl.cursor() sql = '''select * from test1 ''' cur.execute(sql.decode('utf8')) records = cur.fetchall() lines = len(records) for i in range(lines): print records[i] cur.close()
相关文章推荐
- python 使用 mechanize 模拟浏览器访问网页
- 使用python标准库urllib2访问网页
- 使用python访问网络上的数据
- 随笔记:如何使用Python连接(/操作)Oracle数据库(Windows平台下)
- oracle_fdw的使用:从PostgreSQL中访问Oracle数据库,实现数据库数据的同步
- Python3使用urllib访问网页
- 简介使用ASP.NET访问Oracle数据库的方法
- 简介使用ASP.NET访问Oracle数据库的方法
- 在Python中使用cx_Oracle来访问Oracle
- 如何使用python逆向访问列表
- 使用ocilib库访问oracle数据库
- 如何使用python访问ECMWF公共数据集
- python使用cx_oracle连接oracle数据库
- python3使用多代理访问网站
- 『Python CoolBook』使用ctypes访问C代码_上_用法讲解
- python使用httplib2访问REST服务的例子
- python 使用代理访问网站
- python 使用 'python -m pip install --upgrade pip'提示PermissionError: [WinError 5] 拒绝访问
- 使用Python2.4在Linux下访问SQL Server(安装篇)
- 简介使用ASP.NET访问Oracle数据库的方法