Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6cd6c55

Browse files
authored
Add Exadata Express Python example (#43)
Signed-off-by: Gerald Venzl <gerald.venzl@gmail.com>
1 parent 42efb78 commit 6cd6c55

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This repository stores a variety of examples demonstrating how to use the Oracle
55
| ------------- | ------------- |
66
| [db-sample-schemas](https://github.com/oracle/db-sample-schemas) | Git submodule of the Oracle Database Sample Schemas |
77
| [dotnet](./dotnet) | .NET based examples |
8+
| [exadata-express](./exadata-express) | Exadata Express examples |
89
| [java](./java) | Java based examples |
910
| [javascript](./javascript) | JavaScript based examples |
1011
| [optimizer](./optimizer) | Oracle Optmizer and Optimizer Stats examples |

‎exadata-express/Query.py‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#------------------------------------------------------------------------------
2+
# Query.py
3+
#
4+
# Demonstrate how to perform a query of a database schema, configured with Oracle's sample HR Schema, in your Exadata Express
5+
# Cloud Service.
6+
#
7+
# Before running this app:
8+
# 1. From the Exadata Express Cloud Service Console, click on Develop, then click on Python. Follow displayed instructions to:
9+
# - Install instant client.
10+
# - Enable client access and download your Exadata Express Cloud Service credentials.
11+
# - Install the Python Extension module (cx_Oracle) to enable access to your cloud service.
12+
# 2. Create a schema using the Exadata Express Cloud Service Console. Remember the schema name and password for step 4.
13+
# 3. Configure the schema with Oracle's Sample HR Schema. Scripts to configure this schema can be found on GitHub.
14+
# See github.com/oracle/db-sample-schemas for scripts and instructions.
15+
# 4. Modify cx_Oracle.connect to connect to the HR schema you created in step 2:
16+
# - The first value is the name of your HR schema.
17+
# - The second value is the password for your HR schema.
18+
# - The third value is "dbaccess", which is defined in the wallet downloaded from the Exadata Express Cloud Service
19+
#------------------------------------------------------------------------------
20+
21+
from __future__ import print_function
22+
23+
import cx_Oracle
24+
25+
26+
connection = cx_Oracle.connect('HR',password,'dbaccess')
27+
28+
sql = """
29+
select * from employees where department_id = 90"""
30+
31+
32+
print("Get all rows via iterator")
33+
cursor = connection.cursor()
34+
for result in cursor.execute(sql):
35+
print(result)
36+
print()
37+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /