Overcomplicated oracle jdbc BLOB handling

The update approach you mention in the first case can be rewritten using pure JDBC code and thus reduce your dependency on Oracle-specific classes. This could be helpful if your app needs to be database agnostic. public static void updateBlobColumn(Connection con, String table, String blobColumn, byte[] inputBytes, String idColumn, Long id) throws SQLException { PreparedStatement … Read more

Most efficient solution for reading CLOB to String, and String to CLOB in Java?

Ok I will suppose a general use, first you have to download apache commons, there you will find an utility class named IOUtils which has a method named copy(); Now the solution is: get the input stream of your CLOB object using getAsciiStream() and pass it to the copy() method. InputStream in = clobObject.getAsciiStream(); StringWriter … Read more

ORA-00932: inconsistent datatypes: expected – got CLOB

You can’t put a CLOB in the WHERE clause. From the documentation: Large objects (LOBs) are not supported in comparison conditions. However, you can use PL/SQL programs for comparisons on CLOB data. If your values are always less than 4k, you can use: UPDATE IMS_TEST SET TEST_Category = ‘just testing’ WHERE to_char(TEST_SCRIPT) = ‘something’ AND … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)