Index: Connection.c
===================================================================
--- Connection.c	2011-03-19 16:05:30.000000000 -0700
+++ Connection.c	2012-08-01 09:22:17.000000000 -0700
@@ -713,6 +713,21 @@
     if (newPasswordObj)
         return Connection_ChangePassword(self, self->password, newPasswordObj);
 
+#ifdef OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE
+    /* set lob prefetch attribute to session */
+    ub4 default_lobprefetch_size = 4096;                  /* Set default size to 4K */
+    status = OCIAttrSet (self->sessionHandle, (ub4) OCI_HTYPE_SESSION,
+                (void *)&default_lobprefetch_size,               /* attribute value */
+                0,                      /* attribute size; not required to specify; */
+                (ub4) OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE,
+                self->environment->errorHandle);
+    if (Environment_CheckForError(self->environment, status,
+            "Connection_Connect(): OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE") < 0) {
+        self->sessionHandle = NULL;
+        return -1;
+    }
+
+#endif
     // begin the session
     Py_BEGIN_ALLOW_THREADS
     status = OCISessionBegin(self->handle, self->environment->errorHandle,

Index: Cursor.c
===================================================================
--- Cursor.c	2011-03-19 16:05:30.000000000 -0700
+++ Cursor.c	2012-08-01 09:15:53.000000000 -0700
@@ -1813,8 +1813,8 @@
         }
     }
     Py_BEGIN_ALLOW_THREADS
-    status = OCIStmtFetch(self->handle, self->environment->errorHandle,
-            numRows, OCI_FETCH_NEXT, OCI_DEFAULT);
+    status = OCIStmtFetch2(self->handle, self->environment->errorHandle,
+            numRows, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
     Py_END_ALLOW_THREADS
     if (status != OCI_NO_DATA) {
         if (Environment_CheckForError(self->environment, status,

Index: ExternalLobVar.c
===================================================================
--- ExternalLobVar.c	2011-03-19 16:05:30.000000000 -0700
+++ ExternalLobVar.c	2012-07-31 14:26:16.000000000 -0700
@@ -170,6 +170,8 @@
     int offset)                         // offset
 {
     sword status;
+    oraub8 blength = 0;
+    oraub8 clength = *length;
 
     if (var->lobVar->isFile) {
         Py_BEGIN_ALLOW_THREADS
@@ -183,11 +185,13 @@
     }
 
     Py_BEGIN_ALLOW_THREADS
-    status = OCILobRead(var->lobVar->connection->handle,
+    status = OCILobRead2(var->lobVar->connection->handle,
             var->lobVar->environment->errorHandle,
-            var->lobVar->data[var->pos], length, offset, buffer,
-            bufferSize, NULL, NULL, 0, var->lobVar->type->charsetForm); 
+            var->lobVar->data[var->pos], &blength, &clength, offset, buffer,
+            bufferSize, OCI_ONE_PIECE, NULL, NULL, 0, var->lobVar->type->charsetForm);
     Py_END_ALLOW_THREADS
+    *length = blength;
+
     if (Environment_CheckForError(var->lobVar->environment, status,
             "ExternalLobVar_LobRead()") < 0) {
         OCILobFileClose(var->lobVar->connection->handle,
@@ -219,10 +223,10 @@
     udt_ExternalLobVar *var)            // variable to return the size of
 {
     sword status;
-    ub4 length;
+    oraub8 length;
 
     Py_BEGIN_ALLOW_THREADS
-    status = OCILobGetLength(var->lobVar->connection->handle,
+    status = OCILobGetLength2(var->lobVar->connection->handle,
             var->lobVar->environment->errorHandle,
             var->lobVar->data[var->pos], &length);
     Py_END_ALLOW_THREADS
@@ -259,10 +263,9 @@
             amount = 1;
     }
     length = amount;
-    if (var->lobVar->type == &vt_CLOB)
+    if ((var->lobVar->type == &vt_CLOB) || (var->lobVar->type == &vt_NCLOB))
+        // Always use environment setting for character LOBs
         bufferSize = amount * var->lobVar->environment->maxBytesPerCharacter;
-    else if (var->lobVar->type == &vt_NCLOB)
-        bufferSize = amount * 2;
     else bufferSize = amount;
 
     // create a string for retrieving the value
