-1

全員解雇です。それはさておき、 cx_Oracleモジュールを使用して Oracle データベースに接続しようとしたときに表示されるエラー コードを解読するのに助けが必要です。無責任で馬鹿げた理由で、私は Python3000 の代わりに Python2.7 を使用しています。私が見るエラーメッセージは次のとおりです(もちろんコピー/貼り付け):

>>> connection = cx_Oracle.connect('user', 'password123', 'db1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: DPI-1050: Oracle Client library is at version 11.2 but
must be at version 0.0 or higher
>>>

このコマンドを使用して、モジュール自体の内部にいくつかのひどいドキュメントを見つけました。help('cx_Oracle.connect')

このコマンドは次のページを生成します。簡潔にするために最初のページのみを示しています。

Help on class Connection in cx_Oracle:

cx_Oracle.connect = class Connection(__builtin__.object)
 |  Methods defined here:
 |
 |  __enter__(...)
 |
 |  __exit__(...)
 |
 |  __init__(...)
 |      x.__init__(...) initializes x; see help(type(x)) for signature
 |
 |  __repr__(...)
 |      x.__repr__() <==> repr(x)
 |
 |  begin(...)
 |
 |  cancel(...)
 |
 |  changepassword(...)
 |
 |  close(...)
 |
 |  commit(...)
 |
 |  createlob(...)
 |
 |  cursor(...)
 |
 |  deq(...)
 |
 |  deqoptions(...)
 |
 |  enq(...)
 |
 |  enqoptions(...)
 |
 |  getSodaDatabase(...)
 |
 |  gettype(...)
 |
 |  msgproperties(...)
 |
 |  ping(...)
 |
 |  prepare(...)
-- More  -- 

次の Web ページで、API の使用方法に関するより良い説明を見つけました: https://dzone.com/articles/python-code-can-connect-oracle

Web ページの作成者が次のようなことを行ったのに、なぜモジュールの作成者が明確な指示を書かなかったのか疑問に思います。

# Connect using the ordered parameters user, password and SID.
dbconn = cx_Oracle.connect('user', 'password' ,'SID')

また、次の URL でいくつかのドキュメントを見つけました: https://developer.oracle.com/databases/database-for-python-developers-1

このドキュメントは、おそらく別の時代のもので、Oracle データベースの以前の実装用のものです。

私が収集したところによると、このプラグインは 11g Oracle データベース専用で、おそらくそれ以下です。私が使用しているプラ​​ガブル データベースと通常のデータベースは、適切な用語がないため、すべて 12c です。このプラグインは、バージョン <=11 の Oracle データベース専用ですか?

以下のコピー/貼り付けは、データベースの 1 つからのバナーを示しています。

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing op
ions

謹んで、

愚かな男

- - - - - - - - - - - アップデート - - - - - - - - - - - - - - -------------------------

このソフトウェア プロジェクトのアドバイスに基づいて開発者の助けを借りたところ、新しいエラーが発生しました。Oracle DB のバージョン 11 に関してパスから必要ないと思われるものをいくつか削除したところ、新しいエラー メッセージが表示されました。

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> connection = cx_Oracle.connect('user', 'password', 'oracledb')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot be loaded
: "C:\app\client\corpDrone\product\12.1.0\client_1\bin\oci.dll is not the correct a
rchitecture". See https://oracle.github.io/odpi/doc/installation.html#windows fo
r help

私はそれを考え出した。上記のエラー メッセージのリンクをたどり、32 ビット インスタント クライアント ライト ソフトウェアをダウンロードして、これをパスの最初に配置しました。次に、マニュアルに従い、TNS_NAMES 環境変数から 2 番目に参照されるパスに tnsnames.ora ファイルを配置しました。:)これが後で申し訳ありませんがジャークするのに役立つことを願っています. :D

さらに簡単なオプションは、Python の実装を再インストールすることです。私の場合、64 ビットの Oracle DBMS ソフトウェアと通信するには 64 ビットの Python が必要です。

4

1 に答える 1