Instance Three: SELECT * FROM DATABASE

#!/usr/bin/env python
#--*-- coding:utf-8 --*--
__author__ = ‘Kevin‘

import MySQLdb as mdb
import sys

con = mdb.connect(‘localhost‘,‘root‘,‘redhat‘,‘test‘)

try:
    with con:
        cur = con.cursor()
        cur.execute("SELECT * FROM Writers")

        rows = cur.fetchall()

        for row in rows:
            print row
finally:
    con.close()

Result:

(1L, ‘Jack London‘)
(2L, ‘Tik Tok‘)
(3L, ‘Harry Potter‘)
#!/usr/bin/env python
#--*-- coding:utf-8 --*--
__author__ = ‘Kevin‘

import MySQLdb as mdb
import sys

con = mdb.connect(‘localhost‘,‘root‘,‘redhat‘,‘test‘)

try:
    with con:
        cur = con.cursor()
        cur.execute("SELECT * FROM Writers")

        numrows = int(cur.rowcount)

        for i in range(numrows):
            row = cur.fetchone()
            print row[0],row[1]
finally:
    con.close()
时间: 2024-10-23 06:03:30

Instance Three: SELECT * FROM DATABASE的相关文章

P6 EPPM Manual Installation Guide (Oracle Database)

Contents Oracle Database Manual Configuration Overview ,,★★5 Oracle Database Installation ,,★★6 Creating the Database Structure for Oracle and Loading Application Data ,,★★7 Creating the P6 EPPM Database Structure for Oracle ,,★★7 Copying the Script

P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1

P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1       May 2016 Contents About This Guide...................................................................................... 11 Shared Topics in This Guide .

【翻译自mos文章】当控制文件的备份丢失是,怎么restore database

当控制文件的备份丢失是,怎么restore database? 来源于: How to restore database when controlfile backup missing (文档 ID 1438776.1) 适用于: Oracle Database - Enterprise Edition - Version 9.2.0.1 to 11.2.0.3 [Release 9.2 to 11.2] Information in this document applies to any p

Oracle创建Physical Standby Database案例

The following is the detail steps of how to create a physical standby database: This case is created, operated and followed on the steps from oracle online help documentation. The configuration of the two sites server as following: Primary Database:

Managing an Oracle Instance

初始化参数文件: -PFILE:Static parameter file,PFILE -SPFILE:Persistent server parameter file,SPFILE PFILE-- initSID.ora ·Text file ·Modified with an operating system editor ·Modifications made manually ·Changes take effect on the next start up ·Only opened d

To restore the database on a new host-将数据库恢复至一个新的主机上

To restore the database on a new host:1. Ensure that the backups of the target database are accessible on the new host.2. Configure the ORACLE_SID on hostb.3. Start RMAN on hostb and connect to the target database without connecting to the recovery c

Oracle 11g RAC database on ASM, ACFS or OCFS2

I see a lot of questions on shared file systems that can be used when people move from single instance to Oracle RAC database and Grid Infrastructure. The most common question is the following: “Should I place archive logs in OCFS2 or ASM or ACFS of

创建数据库 - with CREATE DATABASE STATEMENT

1. Set SIDin bashORACLE_SID=ocmexport ORACLE_SID2. Set Env VarsORACLE_SID and ORACLE_HOME3. Choose a Database Administrator Authentication Methodpassword fileOS auth4. Create Init Parameter File$ORACLE_HOME/dbs/initocm.ora6. Connect to the InstancePa

Developing DataBase Applications Using MySQL Connector/C++ 中文文本

Developing DataBase Applications Using MySQL Connector/C++ 中文文本 ? by grayondream 翻译自mysql Connector C++帮助文档[http://download.csdn.net/detail/midle110/4931166] ? 本教程将利用从MySQL数据库中链接,插入和检索数据的简单示例向您展示构建和安装MySQL Connector / C ++驱动程序的基本步骤.因为本文的重点是使用C++ Conn