我尝试从 Raspberry pi 在 python 中发出 Oracle 请求。问题是:
“Oracle 不支持 Raspberry Pi 使用的 ARM CPU 架构。您下载并解压缩了 Oracle Instant Client,但它实际上无法运行。没有 Oracle 客户端库,cx_oracle 将无法工作,通用 Python ODBC 也无法运行连接器。”
但我需要 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.so
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'
如何解决?