Menu

does dbform support oracle's blob type?

Help
air lulu
2005-04-22
2013-06-03
  • air lulu

    air lulu - 2005-04-22

    i find out all the code in dbform and dont't meet the code written to handle blob field for oracle.
    i know that handling blob in oracle with jdbc is differ from other database.
    so i ask here "does dbform supoort oracle's blob field"?

     
    • Henner Kollmann

      Henner Kollmann - 2005-04-22

      What's the problem the way dbforms handles blobs? It's the standard jdbc way.

       
    • air lulu

      air lulu - 2005-04-23

      if using "thin" mode to access oracle,the size of the blob object using normal jdbc code to insert to oracle is limited to 4000.
      except that using "oci" mode or special code using oracle.sql.BLOB.

      just see here:
      http://mail-archives.apache.org/mod_mbox/db-ojb-dev/200408.mbox/%3c20040815223911.17692.qmail@minotaur.apache.org%3e

      because i have to migrate a webapp from db2 to oracle, and meet the problem that "connection peer reset" error when i upload a file which size large than 4K,

       
      • Henner Kollmann

        Henner Kollmann - 2005-04-23

        We do not support special driver stuff directly. Feel free to help us reworking the blob access stuff.

        Or do not use the thin client.

        Regards,
        Henner

         
        • Andreas Studer

          Andreas Studer - 2008-01-24

          You can blame oracle not having a decent solution for this. However, the decision for Oracle or not is not always up to the hands of the DBForms programmer. As far as I've heard, alot getting better in Oracle 10g, but it's still not fully standard compliant.

          However, there are two solutions if you have the problem:
          1. Use http://l3x.net/imwiki/Wiki.jsp?page=JdbcOraWrapper
          2. include some special oracle code in DBForms, which works with all oracle and jdbc versions (maybe this needs some special parameter in dbforms-config.xml to switch on / off). Example is for CLOB's, but works with BLOB's too.

          public class OracleClobHelper {
              /**
               *
               */
              public static String getClobValue(Clob clob) throws SQLException, IOException {
                  if (clob == null) return "";
                  StringBuffer sb = new StringBuffer();
                  char buffer[] = new char[4096];
                  Reader r = clob.getCharacterStream();
                  while (true) {
                      int n = r.read(buffer);
                      if (n == -1) break;
                      sb.append(buffer, 0, n);
                  }
                  r.close();
                  return new String(sb);
              }

              /**
               *
               */
              public static void setClobValue(Clob clob, String value) throws SQLException,
                  IOException, ClassNotFoundException, SecurityException, NoSuchMethodException,
                  IllegalArgumentException, IllegalAccessException, InvocationTargetException {
                  // Use Reflection here to avoid a compile time dependency
                  // on the Oracle JDBC driver.
                  Class oracleClobClass = Class.forName("oracle.sql.CLOB");
                  Method m = oracleClobClass.getMethod("getCharacterOutputStream", new Class[]{});
                  Writer w = (Writer) m.invoke(clob, new Object[]{});
                  w.write(value);
                  w.close();
              }
          }

           

Log in to post a comment.

MongoDB Logo MongoDB