I'm using python's jaybedeapi to connect to an Oracle database. Everything seems to be working fine, except when I encounter fields with oracle.sql.clob
data:
Connection & query:
conn = jaydebeapi.connect('oracle.jdbc.OracleDriver','jdbc:oracle:thin:user/pass@host:port:db')
cur = conn.cursor()
cur.execute("select * from table")
data = cur.fetchmany(size=10)
print data[0][1]
Returning:
<jpype._jclass.oracle.sql.CLOB at 0x5fe83d543c92>
How can I print the value in these fields?
EDIT:
I prefer not to explicitly call out each field DBMS_LOB.substr(field,3000)
in the select statement (which works). If possible, I'd rather have a solution directly in python.
This just worked for me:
I'm using jaydebeapi version 0.2.0 and jpype 0.5.7, Python 2.7.10/32 on Win 7/64. Found the solution here: http://almostflan.com/t/embedclob/ though I didn't have the autocommit issue he did.