Java Derby with CLOB & BLOB

Hello,
i want to read an "OLE-Object (BLOB)" and Remarks data column from a MS Access database and must store these data into a Java Derby database. Must i convert these data types into CLOB and BLOB?
Have somebody a code example for this?
Thank you
Tom

Sorry, i mean "Text" datatype instead of Remarks in the MS Access database!
Best regards
Tom

Similar Messages

  • ?Working with clob and blob - using Dbms_Lob

    I need to search through a blob and remove some of the data, but having problems working with dbms_lob.erase.
    Reading the documentation, the procedure is supposed to work with either blobs or clobs, but I can't get it to work with the blob.
    Here's what I've coded and it does not work correctly for blobs.
    What have I've done wrong?
    declare
    v_start                   integer;
    v_stop                    integer;
    v_amount                  integer;
    v_max_len                  integer:=32676;
    v_offset                   integer:=1;
    v_new_length               integer;
    v_clob clob;
    v_blob blob;
    begin
    update test_clob
    set clob_id = clob_id
    where clob_id = 1
    returning clob_desc into v_clob;
    v_start := 0;
    v_stop  := 0;
    v_amount := 0;
    v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
    v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
    v_amount := ((v_stop - v_start)+11) ;
    dbms_output.put_line('Clob: '||v_clob);
    dbms_lob.erase(v_clob, v_amount, v_start);
    dbms_output.put_line('Clob: '||v_clob);
    rollback;
    update test_clob
    set clob_id = clob_id
    where clob_id = 1
    returning blob_desc into v_blob;
    v_start := 0;
    v_stop  := 0;
    v_amount := 0;
    v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
    v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
    v_amount := ((v_stop - v_start)+11) ;
    dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    dbms_lob.erase(v_blob, v_amount, v_start);
    dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    rollback;
    end trg_bui_user_assoc_layout;
    /This is the output
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test

    Well, you left out the table DDL and your insert for sample data (would be nice to have) as well as your Oracle version (pretty much a necessity).
    Since i had to make my own there could be a difference in how you populated your table, but i can't reproduce your findings.
    ME_ORCL?drop table test_clob purge;
    Table dropped.
    Elapsed: 00:00:00.09
    ME_ORCL?
    ME_ORCL?create table test_clob
      2  (
      3     clob_id     number not null primary key,
      4     clob_desc   clob,
      5     blob_desc   blob
      6  );
    Table created.
    Elapsed: 00:00:00.03
    ME_ORCL?
    ME_ORCL?insert into test_clob values
      2  (
      3        1
      4     ,  'this is only a test <property name="Name">SortMode</property>  should leave this alone'
      5     ,  utl_raw.cast_to_raw('this is only a test <property name="Name">SortMode</property>  should leave this alone')
      6  );
    1 row created.
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?commit;
    Commit complete.
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?declare
      2  v_start                   integer;
      3  v_stop                    integer;
      4  v_amount                  integer;
      5  v_max_len                  integer:=32676;
      6  v_offset                   integer:=1;
      7  v_new_length               integer;
      8
      9  v_clob clob;
    10  v_blob blob;
    11
    12  begin
    13
    14   update test_clob
    15   set clob_id = clob_id
    16   where clob_id = 1
    17   returning clob_desc into v_clob;
    18
    19   v_start := 0;
    20   v_stop  := 0;
    21   v_amount := 0;
    22
    23   v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
    24   v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
    25   v_amount := ((v_stop - v_start)+11) ;
    26
    27   dbms_output.put_line('Clob: '||v_clob);
    28
    29   dbms_lob.erase(v_clob, v_amount, v_start);
    30
    31   dbms_output.put_line('Clob: '||v_clob);
    32
    33   rollback;
    34
    35   update test_clob
    36   set clob_id = clob_id
    37   where clob_id = 1
    38   returning blob_desc into v_blob;
    39
    40   v_start := 0;
    41   v_stop  := 0;
    42   v_amount := 0;
    43
    44   v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
    45   v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
    46   v_amount := ((v_stop - v_start)+11) ;
    47
    48   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    49
    50   dbms_lob.erase(v_blob, v_amount, v_start);
    51
    52   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    53
    54   rollback;
    55
    56  end trg_bui_user_assoc_layout;
    57  /
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test                                            should leave this alone
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.03
    ME_ORCL?select *
      2  from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.03
    ME_ORCL?

  • How to improve Oracle Veridata Compair pair performance with tables that have big (30-40MB)CLOB/BLOB fileds ?

    How to improve Oracle Veridata Compair pair performance with tables that have big (30-40MB)CLOB/BLOB fileds ?

    Can you use insert .. returning .. so you do not have to select the empty_clob back out.
    [I have a similar problem but I do not know the primary key to select on, I am really looking for an atomic insert and fill clob mechanism, somone said you can create a clob fill it and use that in the insert, but I have not seen an example yet.]

  • Issue with Oracle datatypes like RAW,CLOB&BLOB

    Hello,
    I have developed an windows application using c#
    My requirement is to display data which having datatypes as RAW,CLOB,BLOB etc:
    But i am not able to bind these datatypes to gridview in my application.
    Pleasse ,suggest me way how to fix this.

    You'll need to provide some more details such as a short code snippet of what you are doing?
    What is your expectation as to how a RAW or BLOB should be displayed in a GridView?

  • Java functions with Oracle 10g

    I have browsed through other related message threads on this forum and it seems that the general recommendation is to develop stored procedures and functions using PL/SQL.
    I need to implement a set of functions that perform date related processing and are self contained (no SQL code or calls). For this I could reuse some Java methods that I have successfully used in an Apache Derby database. In this situation what is your experience related to performance of Java functions compared to PL/SQL? Does the effort of rewriting this code in PL/SQL make sense?

    I made some changes on the class posted by to solve the encoding problems with CLOBs.
    So here is the result of my job.
    import java.sql.SQLException;
    import oracle.sql.*;
    import java.io.*;
    import java.util.zip.InflaterInputStream;
    import java.util.zip.DeflaterOutputStream;
    * A simple class for LOB compression and decompression in Oracle Database.
    * Will work in 8i and better.  Use utl_compress from 10g onward.
    public class CompressionUtility {
         private static void pipeStreams( InputStream inStream, OutputStream outStream, int bufferSize) throws IOException {
              //System.out.println("PIPE -");
              byte[] buffer=new byte[bufferSize];
              int cnt;
              while ((cnt=inStream.read(buffer))!=-1) {
                   outStream.write(buffer,0,cnt);
         private static void pipeStreams( Reader inStream, Writer outStream) throws IOException {
              //System.out.println("PIPE Reader-Writer");
              int val = 0;
              while ( (val = inStream.read()) != -1 ) {
                   outStream.write(val);
         private static void pipeStreams( Reader inStream, OutputStream outStream) throws IOException {
              //System.out.println("PIPE Reader-");
              int val = 0;
              while ( (val = inStream.read()) != -1 ) {
                   outStream.write(val);
        private static void pipeStreams( InputStream inStream, Writer outStream) throws IOException {
              System.out.println("PIPE -Writer");
              int val = 0;
              while ( (val=inStream.read()) != -1 ) {
                   outStream.write(val);
    * Compresses the CLOB into BLOB
    * @param clob the source CLOB (plain text)
    * @param blob the target BLOB (will hold compressed binary data) it should be
    * an empty BLOB retrieved for example with dbms_lob.createtemporary(l_blob,true);
    * @throws Exception mostly I/O exception if ever
         public static void compress(CLOB clob, BLOB blob) throws IOException, SQLException {
              //System.out.println("Compressione C->B");
              Reader in=clob.getCharacterStream();
              Writer z=new OutputStreamWriter(new DeflaterOutputStream(blob.getBinaryOutputStream()));
              DeflaterOutputStream z = new DeflaterOutputStream(blob.getBinaryOutputStream());
              int val = 0;
              while ( (val=in.read()) != -1 ) {
                   z.write(val);
              pipeStreams(in, z);
              in.close();
              z.close();
    * Decompresses the BLOB into CLOB
    * @param blob the source BLOB (compressed binary data)
    * @param clob the target CLOB (will hold plain text) it should be an empty CLOB
    * retrieved for example with dbms_lob.createtemporary(l_clob,true);
    * @throws Exception mostly I/O exception if ever
        public static void decompress(BLOB blob, CLOB clob)
          throws IOException, SQLException {
               //System.out.println("Decompressione B->C");
            Writer out=clob.getCharacterOutputStream();
            Reader z=new InputStreamReader(new InflaterInputStream(blob.getBinaryStream()));
              InflaterInputStream z = new InflaterInputStream(blob.getBinaryStream());
            int val = 0;
              while ( (val=z.read()) != -1 ) {
                   out.write(val);
            pipeStreams(z, out);
            z.close();
            out.close();
    * Compresses the BLOB into BLOB
    * @param slob the source BLOB (plain binary data)
    * @param blob the target BLOB (will hold compressed binary data) it should be
    * an empty BLOB retrieved for example with dbms_lob.createtemporary(l_blob,true);
    * @throws Exception mostly I/O exception if ever
        public static void compress(BLOB slob, BLOB blob)
          throws IOException, SQLException {
               //System.out.println("Compressione B->B");
            InputStream in=slob.getBinaryStream();
            DeflaterOutputStream z=new DeflaterOutputStream(blob.getBinaryOutputStream());
            pipeStreams(in, z, blob.getBufferSize());
            in.close();
            z.close();
    * Decompresses the BLOB into CLOB
    * @param blob the source BLOB (compressed binary data)
    * @param slob the target CLOB (will hold plain binary data) it should be an
    * empty CLOB retrieved for example with dbms_lob.createtemporary(l_blob,true);
    * @throws Exception mostly I/O exception if ever
        public static void decompress(BLOB blob, BLOB slob)
          throws IOException, SQLException {
               //System.out.println("Decompressione B->B");
            OutputStream out=slob.getBinaryOutputStream();
            InflaterInputStream z=new InflaterInputStream(blob.getBinaryStream());
            pipeStreams(z, out, blob.getBufferSize());
            z.close();
            out.close();
    }The main problem was with the getAsciiStream() function that has to be replaced by getCharacterStream().

  • Java.sql.Types.CLOB not returned

    When I run the following on an oracle 8.1.7 server using thin/OCI driver on a table with a CLOB column,
    DatabaseMetaData dbmd = conn.getMetaData();
    ResultSet rs = dbmd.getColumns( null, null, tableName, "%" );
    while (rs.next()){
    int colType = (int)rs.getShort(5);
    I dont get java.sql.Types.CLOB returned in colType, instead I get java.sql.Types.OTHER.
    However, after a query on the same table, the result set metadata.getColumnType() returns java.sql.Types.CLOB.
    Any ideas?
    Thanks in advance

    You can't do that. You can't do it in SQL either: there's no way to call a stored procedure without providing parameters of a specific type.
    There are two things you can do, however: one is to declare the parameter as VARCHAR and hope it's not a BLOB or something that the db will not automatically convert to VARCHAR and the other is to do a SELECT in the procedure you are calling instead of returning the value as an output parameter. The second option is better in that you can then use ResultSet.getObject() from Java and obtain the correct object type, not a String you might need to parse afterwards.
    Alin.

  • How to find out list of clob/blob tables in a schema

    Hi,
    I have tricky situation...i have 119 tables out of which 11 tables are clob/blob tables...is there any view where i can find out list of tables are clob/blob tables? (at schema level view means user_<>)
    -- Raman.

    USER_TAB_COLS includes the data type, column name, and table name for each column in each table in the system. You could query that looking for columns with a DATA_TYPE of CLOB or BLOB. If some tables have multiple LOB columns and you want them to appear only once, you'd have to throw a DISTINCT on the table name.
    Justin

  • Problem with CLOB in PLSQL Web Service.

    Hi-
    I have Oracle Package that accepts CLOB as IN parameter and another CLOB as an OUT parameter. I went thru the tutorial in how to publish a database
    PLSQL package as a web service with out any problem. I was able to publish and call successfully my PLSQL web service thru a browser and thru a simple C# application. It's been working fine until I receive an XML file which is bigger than 32766:
    java.sql.SQLException: setString can only process strings of less than 32766 chararacters at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)]
    JDeveloper version: JDeveloper 10g (10.1.2.2.0) Build 1929
    Oracle Application Server 10g
    I'm newbie in JDeveloper so any help is greatly appreciated.
    Thanks!

    well Shay,
    i've used JDev's tools to developer and to deploy the web service: the war and ear files are automatically generates you to the end of the process.
    I have included all the files java and the compiled classes, but I do not have files jar.
    But don't works: if i create only one java class with all code inside then it works fine!!
    Daniele

  • Help with displaying BLOBs in OBIEE 11g

    I am trying to get OBIEE 11g to display photographs in an Analysis report. I know BLOB fields are not supported, and I have been reading posts on this board and following examples on internet sites that try to get round this problem. But, try as I might, I cannot get those pesky photos to display.
    Below are all the steps I have followed. Sorry that there is a lot to read, but I was hoping that somebody has been successful in doing this, and may spot something in one of my steps that I am doing wrong.
    ORACLE TRANSACTIONAL SOURCE_
    Table : EMPL_PHOTO
    Fields:
    USN VARCHAR2(11) ( Unique Key )
    EMPLOYEE_PHOTO BLOB ( I think the photos are stored as 'png' )
    ORACLE WAREHOUSE SOURCE_
    Table : D_PERSON_PHOTO_LKUP
    Fields :
    PERSON_KEY     NUMBER(38,0) ( Primary Key - Surrogate )
    USN     VARCHAR2(11)
    PHOTO     CLOB
    BLOB to CLOB conversion.
    I used this function :
         create or replace function blob_to_clob_base64(p_data in blob)
         return clob
         is
         l_bufsize integer := 16386;
         l_buffer raw(16386);
         l_offset integer default 1;
         l_result clob;
         begin
         dbms_lob.createtemporary(l_result, false, dbms_lob.call);
         loop
         begin
         dbms_lob.read(p_data, l_bufsize, l_offset, l_buffer);
         exception
         when no_data_found then
         exit;
         end;
         l_offset := l_offset + l_bufsize;
         dbms_lob.append(l_result, to_clob(utl_raw.cast_to_varchar2(utl_encode.base64_encode(l_buffer))));
         end loop;
         return l_result;
         end;
         select usn, employee_photo ,
         BLOB_TO_CLOB_BASE64(employee_photo)
         from empl_photo
    IN OBIEE ADMINISTRATION TOOL_
    *1) Physical Layer*
    Added D_PERSON_PHOTO_LKUP from Connection Pool
    Left it as 'Cachable'
    Didn't join it to any tables
    Changed field PHOTO to a 'LONGVARCHAR' length 100000
    Set USN as the Key ( not the surrogate key )
    *2) BMM Layer*
    Dragged D_PERSON_PHOTO_LKUP across.
    Renamed it to 'LkUp - Photo'
    Ticked the 'lookup table' box
    Removed the surrogate key
    Kept USN as the Primary key
    The icon shows it similar to a Fact table, with a yellow key and green arrow.
    On Dimension table D_PERSON_DETAILS (Dim - P01 - Person Details) added a new logical column
    Called it 'Photo'
    Changed the column source to be derived from an expression.
    Set the expression to be :
    Lookup(DENSE
    "People"."LkUp - Photo"."PHOTO",
    "People"."Dim - P01 - Person Details"."USN" )
    Icon now shows an 'fx' against it.
    Note: This table also had it Surrogate key removed, and USN setting as primary key.
    *3) Presentation Layer*
    Dragged the new Photo field across.
    Saved Repository file, uploaded, and restarted server.
    ONLINE OBIEE_
    Created a new Analysis.
    Selected USN from 'Person Details'
    Selected Photo from 'Person Details'
    Selected a measure from the Fact table
    Under column properties of Photo ( data format ) :
    - Ticked 'Override Default Data Format' box
    - Set to Image URL
    - Custom text format changed to : @[html]"<img alt="" src=""@H"">"
    Under column properties of Photo ( edit formula ) :
    - Changed to : 'data:image/png;base64,'||"Person Details"."Photo"
    The Advanced tab shows the sql as :
         SELECT
         0 s_0,
         "People"."Person Details"."USN" s_1,
         'data:image/png;base64,'||"People"."Person Details"."Photo" s_2,
         "People"."MEASURE"."Count" s_3
         FROM "People"
         ORDER BY 1, 2 ASC NULLS LAST, 3 ASC NULLS LAST
         FETCH FIRST 65001 ROWS ONLY
    Going into the 'results' tab, get error message:
    +State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 17001] Oracle Error code: 932, message: ORA-00932: inconsistent datatypes: expected - got CLOB at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)+
    It doesn't seem to be using the Lookup table, but can't work out at which step I have gone wrong.
    Any help would be appreciated.
    Thanks

    Thanks, yes I followed http://docs.oracle.com/cd/E28280_01/bi.1111/e10540/busmodlayer.htm#BGBDBDHI, but when I get to the part of setting the LOOKUP function on th Physical source, only ONE physical source is displayed. I need TWO sources ( The Employee Table, and the Photo LookUp.
    I have raised this as an error with Oracle. We are now on OBIEE 11.1.1.7, but Oracle say BLOBS are still not supported in that release. It will be fixed in 11.1.1.8 and it will be backported into 11.1.1.6.11
    In the meantime we have abandoned showing Photo's in any of our reports.

  • JDBC ADPATER -  "Unsupported feature" in XI with CLOB type

    Hi experts,
    I have 15 patch XI level.  In  a stored procedure i  use  an in and out parameter with CLOB type.  I get the exception:
    com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'XXXX'): java.sql.SQLException: Unsupported feature
    If  i change the type CLOB by VARVHAR in the XI's XML (Design: Integration Buider), all works fine.
    The strored procedure has this parameter like CLOB.
    My question is
    Is not possible to use the CLOB type?  
    SAP recognize that it, it's possible:
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
    Sorry for my english. Thanks in advance.

    Hi,
    Please make sure you use the 10.x driver for full stored procedure CLOB support.
    A CLOB is a not comparable Datatype in SQL.
    Regards,
    Prateek

  • Multiple CLOB/BLOB

    Hi there,
    I'm looking for the way how to make multiple insert/update on a table with multiple CLOB/BLOB fields using Objects for OLE for C++. When I looked into samples, there is only single insert (of one CLOB). This, in turn, a provided sample will only over-write first inserted LOB with data that becomes to the last inserted row (and last column).
    Thanks in advance for any comment back.
    Nguyen Duy Hoa.

    Hi,
    See the sample BLOBs at the site http://www.geocities.com/oledbpro/docs/examples/blobs.htm, which tells you how to deal with multiple BLOBs/CLOBs etc within a rowset using OleDBPro.
    Yuancai (Charlie) Ye
    See 30 real well-tested advanced OLEDB samples
    Use of free SocketPro for creating super client and server application with numerous samples
    www.udaparts.com

  • Extracting clob/blob/long datatypes in delimited file

    I have a few tables in database that have clob/blob/long datatypes. I need to unload this data into delimited file and reload the data into another database. I don't want to use export/import.
    Currently the code that i have can handle varchar2, number, date datatypes quite easily using sqlloader.
    The tables are not too big (hundred to 10k rows approximately) and performance is important but not crucial. The script can run for a few minutes unloading data, that is fine. Code maintenance is of higher priority with pl/sql being the preferred scripting language.
    From the sqlloader manual, i glean that use of special delimiter is important, something like <startlob> and <endlob> .
    I need ideas on how to do this.

    Hi Buddy.
    I am having same kind of Problem. I am using very similar procedure Instead of PUT_RAW I am using put line.
    Writing is not a problem after writing the image into a file I cannot open that. That means Image got corrupted. If you find out some solutions for your problem please help me
    My email id is [email protected]
    Thanks
    AJI

  • Urgent !! :-(  -  Problems with CLOB

    Hello all,
    I want to write and read in a CLOB. Every thing is OK. But I've a problem !! :-(
    When I close my clob I still have an cursor (table_...) open on my data base(Oracle 8i)
    Can you help me ???
    This is my class witch woks with CLOB :
    import java.io.*;
    import java.sql.*;
    import oracle.sql.CLOB;
    import oracle.jdbc.driver.OracleResultSet;
    import com.pia.best.anf.*;
    import com.pia.best.anf.param.*;
    import com.pia.best.anf.tools.*;
    public class ClobRW {
    * La m�thode <code>readClob</code> lis un Clob � partir d'un
    * ResultSet.
    * @param rs un <code>ResultSet</code> pointant vers le Clob
    * @param idx un <code>int</code> indexant le Clob dans le ResultSet
    * @return une <code>String</code> �gale � la valeur du Clob
    public static String readClobRS(ResultSet res, int idx) {
    String s = "";
    try {          
    CLOB c = ((OracleResultSet)res).getCLOB(idx);
    if (c != null && c.length() >= 2) {
    int j = 1;
    while (j + 1002 <= c.length() + 1) {
    s += c.getSubString(j + 2, 1000); // Les deux premiers caract�res sont bidons...
    j += 1002;
    s += c.getSubString(j + 2, (int) (c.length() - j - 1));
    catch(SQLException e) {
    Parametre.alert(0, "ClobRW.readClobRS", "Probl�me lors de la lecture du ResultSet", "", e);
    return s;
    * La m�thode <code>readClob</code> lis un Clob.
    * @param con une <code>Connection</code> ouverture sur la base de donn�es
    * @param table une <code>String</code> nommant la relation o� se trouve le Clob
    * @param field une <code>String</code> nommant le champ de la relation o� se trouve le Clob
    * @param location une <code>String</code> d�crivant une condition pour extraire une ligne de la relation
    * @return une <code>String</code> �gale � la valeur du Clob
    public static String readClob(Connection con, String table, String field, String location) {
    String s = "";
    try {
    Statement stmt = null;
    ResultSet res = null;
    String query = "";
    try {
    stmt = con.createStatement();
    query = "select " + field + " from " + table + " where " + location;
    res = stmt.executeQuery(query);
    if (res.next()) {
    s = readClobRS(res, 1);
    else {
    Parametre.alert(0, "ClobRW.readClobRS", "Probl�me lors de la lecture du Clob", null, null);
    catch(SQLException e) {
    Parametre.alert(0, "ClobRW.readClob", "Probl�me lors de la r�cup�ration du Clob", query, e);
    if (res != null) res.close();
    if (stmt != null) stmt.close();
    catch(SQLException e) {
    Parametre.alert(0, "ClobRW.readClob", "Probl�me lors de la fermeture du statement/resultset", "", e);
    return s;
    * La m�thode <code>writeClob</code> permet d'�crire un Clob.
    * @param con une <code>Connection</code> ouverture sur la base de donn�es
    * @param table une <code>String</code> nommant la relation o� se trouve le Clob
    * @param field une <code>String</code> nommant le champ de la relation o� se trouve le Clob
    * @param location une <code>String</code> d�crivant une condition pour extraire une ligne de la relation
    * @param s une <code>String</code> �gale � la valeur du Clob
    public static void writeClob(Connection con, String table, String field, String location, String s) {
    try {
    con.setAutoCommit(false);
    Statement stmt = null;
    ResultSet res = null;
    String query = "";
    try {
    stmt = con.createStatement();
    query = "update " + table + " set " + field + " =empty_clob()" + " where " + location;
    stmt.executeUpdate(query);
    query = "select " + field + " from " + table + " where " + location;
    res = stmt.executeQuery(query);
    if (res.next()) {
    CLOB c = (CLOB) res.getObject(1);
    try {
    OutputStream as = c.getAsciiOutputStream();
    if (as != null) {
    DataOutputStream dos = new DataOutputStream(as);
    int i = 0, j = 1000;
    while (j < s.length()) {
    dos.writeUTF(s.substring(i, j));
    i = j;
    j+= 1000;
    dos.writeUTF(s.substring(i, s.length()));
    dos.flush();
    dos.close();
    else {
    Parametre.alert(0, "ClobRW.writeClob", "Impossible de r�cup�rer un stream sur le Clob", query, null);
    as.close();
    catch (IOException e) {
    Parametre.alert(0, "ClobRW.writeClob", "Impossible de manipuler le Clob", query, e);
    else {
    Parametre.alert(0, "ClobRW.writeClob", "Impossible de r�cup�rer le Clob", query, null);
    catch(SQLException e) {
    Parametre.alert(0, "ClobRW.writeClob", "Probl�me lors de cr�ation ou r�cup�ration du Clob", query, e);
    if (res != null) res.close();
    if (stmt != null) stmt.close();
    con.commit();
    con.setAutoCommit(true);
    catch(SQLException e) {
    Parametre.alert(0, "ClobRW.writeClob", "Probl�me lors du passage en transactionnel", "", e);

    Sounds like you have got "hold cursor" property turned on!
    This will keep the cursor open after commit!
    Though it should be closed when you close the resultset

  • Using Berkeley Java Edition with Java Web Start

    Hi
    Have anyone had any experience using Berkeley Java Edition with Java Web Start?. I need to create an application that will download with the database to a client computer and create the database there

    Thanks for your reply Luca-Sanna,
    This is my jnlp file
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/dist" href="launch.jnlp">
    <information>
    <title>MyApplication</title>
    <vendor>My Company</vendor>
    <homepage href="/test.html"/>
    <description>My Test Application</description>
    <description kind="short">My Application</description>
    <icon href="test.gif" kind="default"/>
    <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="myapp.jar" main="true" download="eager"/>
    <jar href="lib/appframework-1.0.3.jar" download="eager"/>
    <jar href="lib/beansbinding-1.2.1.jar" download="eager"/>
    <jar href="lib/commons-beanutils.jar" download="eager"/>
    <jar href="lib/commons-collections.jar" download="eager"/>
    <jar href="lib/commons-digester.jar" download="eager"/>
    <jar href="lib/commons-logging.jar" download="eager"/>
    <jar href="lib/derby.jar" download="eager"/>
    <jar href="lib/derbyclient.jar" download="eager"/>
    <jar href="lib/derbynet.jar" download="eager"/>
    <jar href="lib/itext-1.3.1.jar" download="eager"/>
    <jar href="lib/jasperreports-1.3.0.jar" download="eager"/>
    <jar href="lib/jbossall-client-2004-05-11.jar" download="eager"/>
    <jar href="lib/jdt-compiler-3.1.1.jar" download="eager"/>
    <jar href="lib/poi-2.0-final-20040126.jar" download="eager"/>
    <jar href="lib/swing-worker-1.1.jar" download="eager"/>
    <jar href="lib/toplink-essentials-agent.jar" download="eager"/>
    <jar href="lib/toplink-essentials.jar" download="eager"/>
    </resources>
    <application-desc main-class="mypackage.Login">
    </application-desc>
    </jnlp>
    I have seen many forums with the same above problem with no reply.
    Anyone knows what exactly the problem is?

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

Maybe you are looking for

  • I have CS5.  My computer stopped working.  How do I install it again on my new computer?

    How do I get Adobe Design Premium CS 5 on my new computer?  My old one is not longer working.

  • Step User Decision and Approval of Purchase Order

    Hello All, I have created a workflow with step user decision and also attached the object BUS2012 to display from SAP Inbox. But is there a way i can attached the object that would show the approval screen when the work item is executed, and also sen

  • Acrobat icons all generic with no preview?

    After reinstalling Acrobat 9 pro on a new machine all adobe pdf icons are the generic Adobe icon with no first page preview on them.  Have tried everying from the forum so far but no success. any help would be greatly appreciated!

  • Application builder distribution rights

    Hi, Could someone please clarify the rights we have with regard to distribution of executables created with the application builder. I bought the application builder because its sales pitch was "you can freely create executables and distribute them".

  • ColdFusion & MySql & NaviCat

    I need so help with MySql - its the first time I'm using MySql to run my databases in CF. I have created a MySql database in NaviCat and linked it to my website with CF on my local machine and it's all working. The problem is, I don't know how to loa