python模块之cx_Oracle
2024-10-20 13:46:40
安装cx_Oracle
wget http://download.oracle.com/otn/linux/instantclient/122010/instantclient-basic-linux.x64-12.2.0.1.0.zip unzip instantclient-basic-linux.x64-12.2.0.1.0.zip cd instantclient_12_2/ cp * /usr/lib64 (/usr/lib) pip install cx_oracle
创建py文件,注意名字不要和模块名、python关键字相同
#!/usr/bin/env python2 #-*- coding: utf-8 -*- import cx_Oracle connection = cx_Oracle.connect("peter", "peter", "172.16.1.13:1521/peter") cursor = connection.cursor() data = cursor.execute("select * from student") row = data.fetchall() // 获取所有记录,格式为[(),(),()],一个元组一条记录 for x in row: // 迭代数组
for y in x:
print y,
print one = data.fetchone() // 获取一条记录,格式为元组
最新文章
- 【转载】 Android PullToRefresh (ListView GridView 下拉刷新) 使用详解
- 【转】Android世界的Swift - Kotlin语言
- Blackfin DSP(八):BF533的DMA
- SharePoint 更新文档库文档标题(Title)字段
- HTML Meta标签中的viewport属性含义及设置
- 【Oracle 数据迁移】环境oracle 11gR2,exp无法导出空表的表结构【转载】
- Linux下php安装phpredis
- C语言中指针数组和数组指针的区别
- 【转】iOS-Core-Animation-Advanced-Techniques(四)
- XP系统取消开机硬件检查
- layPage异步分页
- WPF那些事儿
- 更改ORACLE 用户的 expired状态
- (7)基于hadoop的简单网盘应用实现3
- Java 使用blob对H5视频播放进行加密《java视频加密》
- nginx隐藏tp路由index.php
- String 的方法总结
- Component 组件props 属性设置
- Java基本知识进阶
- kubernetes国内镜像拉取
热门文章
- spark(四)
- 【noip2018】【luogu5024】保卫王国
- 【bzoj4372】烁烁的游戏
- 洛谷P2002 消息扩散
- struts的status属性
- [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
- WPF系列之二:解耦View层控件事件与ViewModel层事件的响应
- struts标签错误:Can not find the tag library descriptor for ";http://java.sun.com/jsp/jstl/core";
- [DeeplearningAI笔记]卷积神经网络2.9-2.10迁移学习与数据增强
- OpenCV---超大图像二值化和空白区域过滤