Oracle LOBs using PDO

28 views
Skip to first unread message

Tobia

unread,
Aug 25, 2014, 1:35:55 PM8/25/14
to caucho-...@googlegroups.com, Franco Andrao
Hello

I'm trying to port an application written for an old Quercus release to the latest one, but I'm having problems with LOB fields (BLOB / CLOB) on Oracle.

The application uses PDO with a java:comp/env/jdbc/ address, in order to use a pool of Oracle connections managed by Tomcat.

Unfortunately, in the latest Quercus releases, LOB fields with more than 4000 bytes of data are not returned correctly from result sets. They come out as random binary data.

I've tried a few PDO options, such as bindColumn() with PDO::PARAM_LOB, to no avail.

Then I looked in the source code and noticed this part was taken out of JdbcResultResource.java some time between 4.0.27 and 4.0.28:


--- quercus-4.0.27-src/com/caucho/quercus/lib/db/JdbcResultResource.java
+++ quercus-4.0.28-src/com/caucho/quercus/lib/db/JdbcResultResource.java
@@ -512,26 +610,12 @@
 
             case Types.BLOB:
                 {
-                    Object object = rs.getBlob(column);
-                    if (object.getClass().getName().equals("oracle.sql.BLOB")) {
-                        OracleOciLob ociLob = new OracleOciLob((Oracle) _conn,
-                                                                                                     OracleModule.OCI_D_LOB);
-                        ociLob.setLob(object);
-                        object = ociLob;
-                    }
-                    return env.wrapJava(object);
+                    return getBlobValue(env, rs, getMetaData(), column);
                 }
 
             case Types.CLOB:
                 {
-                    Object object = rs.getClob(column);
-                    if (object.getClass().getName().equals("oracle.sql.CLOB")) {
-                        OracleOciLob ociLob = new OracleOciLob((Oracle) _conn,
-                                                                                                     OracleModule.OCI_D_LOB);
-                        ociLob.setLob(object);
-                        object = ociLob;
-                    }
-                    return env.wrapJava(object);
+                    return getClobValue(env, rs, getMetaData(), column);
                 }


Apparently, this code was moved into the OCI module (OracleResult.java)

Does this mean that Oracle DB can no longer be used with PDO in Quercus?

I did a few tests with the OCI module. Ignoring for a moment the amount of work needed to port all the application code from PDO calls to OCI, I can't get OCI to connect to the DB at all, let alone use the connection pool managed by Tomcat.

Has anybody met this problem yet?

-Tobia
Reply all
Reply to author
Forward
0 new messages