在尝试通过 JDBC 连接到数据库时,我构建了 JPype (JPype1-0.5.5.4) 和 JayDeBeAPI 0.1.4。这是在 RHEL 上。我可以使用驱动程序成功连接,
TrgtCnn = jaydebeapi.connect('com.ibm.as400.access.AS400JDBCDriver',
['jdbc:as400://<mask>','<mask>','<mask>'],
'/app/as/lib/jdbc/jt400.jar')
但是当我执行 SQL 时,我在 JPype 中得到了这个回溯:
TrgtCrs = TrgtCnn.cursor()
TrgtCrs.execute("SELECT * FROM WA6U999S")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-5d46ea8c382d> in <module>()
----> 1 TrgtCrs.execute("SELECT * FROM WA6U999S")
/app/as/opt/anaconda/lib/python2.7/site-packages/jaydebeapi/dbapi2.pyc in execute(self, operation, parameters)
356 parameters = ()
357 self._close_last()
--> 358 self._prep = self._connection.jconn.prepareStatement(operation)
359 self._set_stmt_parms(self._prep, parameters)
360 is_rs = self._prep.execute()
/app/as/opt/anaconda/lib/python2.7/site-packages/JPype1-0.5.5.4-py2.7-linux-x86_64.egg/jpype/_jclass.pyc in _getClassFor(javaClass)
66 return _CLASSES[name]
67
---> 68 pyJavaClass = _JavaClass(javaClass)
69 _CLASSES[name] = pyJavaClass
70 return pyJavaClass
/app/as/opt/anaconda/lib/python2.7/site-packages/JPype1-0.5.5.4-py2.7-linux-x86_64.egg/jpype/_jclass.pyc in __new__(mcs, jc)
123 elif not jc.isInterface():
124 bjc = jc.getBaseClass(jc)
--> 125 bases.append(_getClassFor(bjc))
126
127 if _JAVATHROWABLE is not None and jc.isSubclass("java.lang.Throwable"):
/app/as/opt/anaconda/lib/python2.7/site-packages/JPype1-0.5.5.4-py2.7-linux-x86_64.egg/jpype/_jclass.pyc in _getClassFor(javaClass)
66 return _CLASSES[name]
67
---> 68 pyJavaClass = _JavaClass(javaClass)
69 _CLASSES[name] = pyJavaClass
70 return pyJavaClass
/app/as/opt/anaconda/lib/python2.7/site-packages/JPype1-0.5.5.4-py2.7-linux-x86_64.egg/jpype/_jclass.pyc in __new__(mcs, jc)
166 for i in _CUSTOMIZERS:
167 if i.canCustomize(name, jc):
--> 168 i.customize(name, jc, bases, members)
169
170 # remove multiple bases that would cause a MRO problem
/app/as/opt/anaconda/lib/python2.7/site-packages/JPype1-0.5.5.4-py2.7-linux-x86_64.egg/jpype/_properties.pyc in customize(self, class_name, jc, bases, members)
68
69 def customize(self, class_name, jc, bases, members) :
---> 70 accessor_pairs = _extract_accessor_pairs(members)
71 for attr_name, (getter, setter) in accessor_pairs.items():
72 if attr_name in members:
/app/as/opt/anaconda/lib/python2.7/site-packages/JPype1-0.5.5.4-py2.7-linux-x86_64.egg/jpype/_properties.pyc in _extract_accessor_pairs(members)
46 if _is_java_method(members[property_name]):
47 continue
---> 48 if access == 'get' and member.isBeanAccessor():
49 try:
50 pair = accessor_pairs[property_name]
AttributeError: 'property' object has no attribute 'isBeanAccessor'
我不知道从哪里开始,而且似乎找不到任何提到这个问题的东西。