JDBC 到 Oracle 服务名称 (jaydebeapi) 的错误连接

Error connection with JDBC to Oracle service name (jaydebeapi)

我尝试从 Raspberry pi 在 python 中发出 Oracle 请求。问题是:

"Oracle does not support the ARM CPU architecture which the Raspberry Pi uses. You downloaded and unzipped the Oracle Instant Client, but it can't actually run. And without the Oracle Client libraries, cx_oracle will not work, and neither will generic Python ODBC connectors."

但我需要 python,所以安装了 JPype 和 JayDeBeApi,我在 jupyter notebopok 上写了这个:

import jaydebeapi
import jpype
from jpype import *
classpath="ava-1.5.0-gcj-6-armhf"
jvm_path = "/usr/lib/jvm/java-1.5.0-gcj-6-armhf/lib"
jHome = jpype.getDefaultJVMPath()
print(jHome)

/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/arm/client/libjvm.所以

conn=jaydebeapi.connect('oracle.jdbc.driver.OracleDriver','[admin]/[root]@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=helloworld.com)(PORT=1521))(CONNECT_DATA=(SID=hello42)))')

但是我有这个错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-34-82d7959b353e> in <module>
----> 1 conn=jaydebeapi.connect('oracle.jdbc.driver.OracleDriver','[admin]/[root]@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=helloworld.com)(PORT=1521))(CONNECT_DATA=(SID=hello42)))')

/usr/local/lib/python3.5/dist-packages/jaydebeapi/__init__.py in connect(jclassname, url, driver_args, jars, libs)
    379     else:
    380         libs = []
--> 381     jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
    382     return Connection(jconn, _converters)
    383 

/usr/local/lib/python3.5/dist-packages/jaydebeapi/__init__.py in _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs)
    181         types_map = {}
    182         for i in types.__javaclass__.getClassFields():
--> 183             types_map[i.getName()] = i.getStaticAttribute()
    184         _init_types(types_map)
    185     global _java_array_byte

AttributeError: '_jpype.PyJPField' object has no attribute 'getStaticAttribute'

如何解决?

你用的是什么版本的JPype?上周发布了一个新版本。如果您使用的是 0.7.0 版本,请尝试使用之前的版本 0.6.3