Updating clob column in oracle with CLOB value

i want to update a column is CLOB type, the method is below;

public boolean formVeriGuncelleSil(String sql) throws VeritabaniException {
        try {
            Session session = getSessionFactory().getCurrentSession();
            SQLQuery query = session.createSQLQuery(sql);
            query.executeUpdate();
            return true;
        } catch (RuntimeException e) {
            throw new VeritabaniException(e, VERIGUNCELLEMEEXCEPTION, "FID_01_02_01");
        }
    }

The sql string;

UPDATE K1FORM_LISTGRID3 SET TEXTAREA4=oracle.sql.CLOB@77df8d, TEXTT5='ANAFORM',ANATABLO='1', OLUSTURAN_KULLANICI='184' WHERE ID=1

i get "java.sql.SQLSyntaxErrorException: ORA-01729: database link name expected" error

How can i fix this sql. Pls help.

Answers


Oracle is interpreting this SQL

SET TEXTAREA4=oracle.sql.CLOB@77df8d

as a database link because of the @ symbol, but it does not matter anyway, because all you're doing here is trying to set the value of the column to the toString of the CLOB, which is not what you intend.

Your code sample does not really outline where the problem is because the method is just a general utility to execute the passed SQL, but I suggest 1 of 2 things:

  1. Go with GriffeyDog's suggestion and switch to using a PreparedStatement where you bind the CLOB using PreparedStatement.setClob.
  2. If you are using the Oracle 11g+ JDBC driver, you can set the value of a CLOB column using a simple Java String.

Need Your Help

What's this Java code doing?

java swing netbeans

I know C/C++/C#/ActionScript/PHP and have worked in all of them. As per my Knowledge we generally initialize object as

What is the ideal font for OCR?

fonts ocr tesseract

Does anybody have any experience with different fonts for OCR? I am generating an ID then trying to scan it with tesseract. At the moment I am just T&E'n different fonts, but this seems pretty

How do I catch jQuery $.getJSON (or $.ajax with datatype set to 'jsonp') error when using JSONP?

javascript jquery jsonp

Is it possible to catch an error when using JSONP with jQuery? I've tried both the $.getJSON and $.ajax methods but neither will catch the 404 error I'm testing. Here is what I've tried (keep in mind

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.