2017-03-11 3 views
0

私はKenneth Ritzのレコードライブラリを使用してOracleに接続しています。Oracleに接続するPythonレコード

db = records.Database('oracle://scott/[email protected]:1521/orcl') 

しかし、それは常にしかし、SQL Plusを経由して接続し、このエラー

DatabaseError: (cx_Oracle.DatabaseError) 
ORA-12545: Connect failed because target host 
or object does not exist. 

をスローは

sqlplus scott/[email protected]/orcl:1521 

SQL*Plus: Release 12.1.0.1.0 Production on Sat Mar 11 17:29:19 2017 

Copyright (c) 1982, 2013, Oracle. All rights reserved. 

Last Successful login time: Sat Mar 11 2017 17:16:24 +05:30 

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

SQL> 

興味深い観察だけで正常に動作し

db = cx_Oracle.connect('scott/[email protected]:1521/orcl') **<--Works** 

db.version 
'12.1.0.1.0' 

db = records.Database('oracle+cx_oracle://scott/[email protected]:1521/orcl') 
doesn't work 

私がやっているものをすべてのアイデア違う ここに ? Inteに

答えて

0

records

は、データベース、重量物の持ち上げを行うにはsqlalchemyを依存しています。 SQLAlchemyのdocumentationを参照してください:

ので、URIがあるべきようなもの: oracle+cx_oracle://user:[email protected]:1521/dbname

+0

おかげUku pointer.Triedため、このデシベル= records.Database( 'オラクル+ cx_oracle://スコット/虎を@localhost:1521/orcl ')でもまだ喜びはありません – user3249433

+0

'scott/tiger'の意味は何ですか? –

+0

残念ですが、scottはユーザー名とパスワードがtiger.db = records.Database( 'oracle + cx_oracle:// scott:tiger @ localhost:1 521/orcl')です。 – user3249433