Simple Python demo app that connects to an Oracle DB. The app is based on the example provided here.
- After you have cloned the repository to your local machine, you download the Oracle client from https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip and extract it into the
example
subdirectory. You should now have anexample/instantclient_21_4
subdirectory created. - Change the permissions on the one lib file:
chmod 755 example/instantclient_21_4/libocijdbc21.so
- Create an
oracledb.json
file with theuser
,password
, anddsn
in the following format to point to your Oracle instance:
{
"username": "system",
"password": "xxxxx",
"dsn": "localhost/xepdb1"
}
-
Create a user-provided service that connects to your external Oracle instance:
cf cups oracledb -p oracledb.json
-
Push the app to Cloud Foundry from the root project directory, using
cf push
. -
The app has 2 endpoints: the root
/
endpoint will query the table of all keys and values; and the/<key>/value
endpoint will add a key/value pair to the table.