|
42 | 42 | # established. |
43 | 43 | # |
44 | 44 | # To use DRCP, the connection string should request the database use a pooled |
45 | | -# server. For example, "localhost/orclpdb:pool". It is best practice for |
| 45 | +# server. For example, "localhost/orclpdb:pooled". It is best practice for |
46 | 46 | # connections to specify a connection class and server purity when creating |
47 | 47 | # a pool |
48 | 48 | # |
|
63 | 63 | # |
64 | 64 | # See the python-oracledb documentation for more information on DRCP. |
65 | 65 | # |
66 | | -# To run this sample, install Flask with: |
67 | | -# pip install --upgrade Flask |
| 66 | +# To run this sample: |
| 67 | +# |
| 68 | +# 1. Install Flask, for example like: |
| 69 | +# |
| 70 | +# python -m pip install Flask |
| 71 | +# |
| 72 | +# 2. (Optional) Set environment variables referenced in sample_env.py |
| 73 | +# |
| 74 | +# 3. Run: |
| 75 | +# |
| 76 | +# python drcp_pool.py |
| 77 | +# |
| 78 | +# 4. In a browser load a URL as shown below. |
68 | 79 | # |
69 | 80 | # The default route will display a welcome message: |
70 | 81 | # http://127.0.0.1:8080/ |
|
87 | 98 | # |
88 | 99 | # Output will be like: |
89 | 100 | # |
90 | | -# CCLASS_NAME NUM_REQUESTS NUM_HITS NUM_MISSES NUM_WAITS NUM_AUTHENTICATIONS |
91 | | -# ---------------- ------------ -------- ---------- --------- ------------------- |
92 | | -# PYTHONDEMO.MYAPP 1001 997 4 0 4 |
| 101 | +# CCLASS_NAME NUM_REQUESTS NUM_HITS NUM_MISSES NUM_WAITS NUM_AUTHENTICATIONS |
| 102 | +# ---------------- ------------ -------- ---------- --------- ------------------- |
| 103 | +# PYTHONDEMO.MYAPP 1001 997 4 0 4 |
| 104 | +# |
| 105 | +# With ADB-S databases, query V$CPOOL_CONN_INFO instead. |
93 | 106 | # |
94 | 107 | #------------------------------------------------------------------------------ |
95 | 108 |
|
96 | | -from flask import Flask |
97 | 109 | import os |
| 110 | +import sys |
| 111 | + |
| 112 | +from flask import Flask |
98 | 113 |
|
99 | 114 | import oracledb |
100 | 115 | import sample_env |
@@ -214,5 +229,8 @@ def show_username(id): |
214 | 229 | # Create a demo table |
215 | 230 | create_schema() |
216 | 231 |
|
| 232 | + m = f"\nTry loading http://127.0.0.1:{port}/user/1 in a browser\n" |
| 233 | + sys.modules['flask.cli'].show_server_banner = lambda *x: print(m) |
| 234 | + |
217 | 235 | # Start a webserver |
218 | 236 | app.run(port=port) |
0 commit comments