Connect() hangs with SSH tunnels and 11g database
まだ誰も着手していません。
評価
調査の方向性
SSHTunnelForwarder、oracledb.connect()、Oracle 11g を使用した、提供されている Python の再現手順から始め、その後、動作する 19c のケースおよび外部トンネルのケースと比較します。報告されている client、Python、SID、認証情報の組み合わせを確認します。ハングの原因を特定して対処し、成功する接続と想定されるエラーを維持できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
-
What versions are you using?
Python 3.13.3 (also tried with 3.11)
Oracledb 3.1.1 (also tried 3.0.0 and 2.5.1)
Oracle database 11g
Oracle instant client 18.5 (also tried with 12.2)platform.platform: Windows-11-10.0.26100-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.13.3
oracledb.version: 3.1.1 -
Is it an error or a hang or a crash? Hang
-
What error(s) or behavior you are seeing?
While trying to connect to 11g databases through SSHtunnels, oracledb.connect() hangs and doesn't return anything.
I tried it on multiple tunnels/databases combinaisons, while mixing oracledb / instantclient / python versions.If I open the tunnel through putty, oracledb.connect works.
If I open the tunnel through another script, oracledb.connect works. (!)
If I try to open a tunnel and connect to a 19c database, it works
If I do the same thing using python 3.9 and cx_oracle, it works.If I provide a wrong username or password, I get an (expected) error.
If I provide a wrong SID, I get an (expected) error.I do see an inactive connection in my v$session linked to my script.
I tried everything I could think of and do not understand what I'm missing.
-
Does your application call init_oracle_client()? Yes, I tried with instant client versions 11.2, 12.1, 18.5
I had success accessing a 19c db using instant client 21.18 through the same tunnel (and same script) -
Include a runnable Python script that shows the problem.
from sshtunnel import SSHTunnelForwarder
import oracledb
# ssh config
ssh_host = "###_tunnel.com"
ssh_port = 21
ssh_username = "ssh_user"
ssh_password = "ssh_psw"
# db config
oracle_host = "ip.of.my.db"
oracle_port = 1521
oracle_sid = "DB_SID"
oracle_user = "DB_USER"
oracle_password = "DB_PSW"
#oracle_client_path = r"C:\instant_client18c\instantclient-basic-windows.x64-18.5.0.0.0dbru\instantclient_18_5"
oracle_client_path = r"C:\instant_client11g\instantclient-basic-windows.x64-11.2.0.4.0\instantclient_11_2"
oracledb.init_oracle_client(lib_dir=oracle_client_path)
print("Thin mode enabled?", oracledb.is_thin_mode())
try:
with SSHTunnelForwarder(
(ssh_host, ssh_port),
ssh_username=ssh_username,
ssh_password=ssh_password,
remote_bind_address=(oracle_host, oracle_port),
) as tunnel:
print(f"binding on {tunnel.local_bind_host}:{tunnel.local_bind_port}")
print(oracledb.clientversion())
param = oracledb.ConnectParams(
user=oracle_user,
password=oracle_password,
host="localhost",
port=tunnel.local_bind_port,
sid=oracle_sid,
)
with oracledb.connect(params=param) as connection:
print("connected to Oracle 11.2!") # this never prints for tunnel + 11g
with connection.cursor() as cursor:
cursor.execute("SELECT 'query success' AS TEST FROM dual")
result = cursor.fetchone()
print(result[0])
except Exception as e:
print(f"Error : {e}")
- 主要言語
- Python
- スター
- 454
- フォーク
- 119
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
oracle/python-oracledb のほかの issue
-
asyncio: DPY-4011 on connect_async() when the listener closes the original socket after a redirect対応中かも @AlexGracas が 7 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
oracle/python-oracledb#616 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
oracle/python-oracledb#615 ·
-
Fetch character columns as raw bytes in the database character set into data frames (Thick mode)オープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
oracle/python-oracledb#614 · コメント 1 件 ·
-
Client Library or Database
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
oracle/python-oracledb#613 · コメント 3 件 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 40/100
oracle/python-oracledb#612 ·
oracle/python-oracledb の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
task
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
danparshall/claude_researcher#87 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
datajoint/datajoint-python#1586 ·
メンテナーはふだん 1 日以内に返信
-
1D intercept of length 1 is accepted as `fix_params` in population GLM with more than 1 unit対応中かも @dhvani7014 が今日担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
flatironinstitute/nemos#642 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
uniswap-python/uniswap-python#487 ·