BLOB column inserts are slow

Hi All,
Have a table with 7 columns where 4 columns are of Varchar2 type, 2 columns are of NUMBER type and 1 column is of type BLOB.
Myself inserting the values to the table from JAVA program. Insertion to VARCHAR2 and NUMBER type columns are very much fast. But insertion to BLOB column is dead slow(data to BLOB column values are about 10KB).
Please help me in this regard to insert BLOB values fastly.
Regards/Sreekeshava S

Sreekeshava S wrote:
Running JAVA program in the same server as that of DB. Connecting how? IPC? TCP? Dedicated server? Shared server?
Calling Oracle how? Doing a SQL statement prepare per insert? Reusing the SQL cursor handle? Binding variables?
And inserting 250 records/ sec(during peak load and 50 records/sec during normal load). where each record is having size of 10K(Blob column size).And what is slow? You have NOT yet provided ANY evidence that points to the actual INSERT being slow.
As I have already explained, there are a number of layers from client to server - and any, or all of these, could be contributing to the problem.
Use your web browser and look up what instrumentation is. Apply it. Instrument your code. On the client. On the server. So you have evidence (call stats and metrics) to use to determine what and where the performance problem is. And not have to guess - and like most developers point your finger at the database in the false belief that your client code, client design, and client usage of the database, are all perfect.

Similar Messages

  • JDBC를 이용해서 BLOB COLUMN 에 파일 INSERT하는 SAMPLE

    제품 : JAVA
    작성날짜 : 2003-01-15
    JDBC를 이용해서 BLOB COLUMN 에 파일 INSERT하는 SAMPLE
    ====================================================
    Purpose
    JDBC를 이용해서 BLOB COLUMN 에 파일 INSERT하는 방법을
    알아 봅니다.
    Explanation
    - 다음 sample은 Oracle DB v8.1.7에서 JDBC(V8.1.7)을
    이용해서 TEST한 것입니다.
    Example
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    //needed for new CLOB and BLOB classes
    import oracle.sql.*;
    public class Insert_File_BLOB
    public static void main (String args [])
    throws Exception
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@krint-7", "scott", "tiger");
    conn.setAutoCommit (false);
    Statement stmt = conn.createStatement ();
    // Drop the basic_lob_table
    try
    stmt.execute ("drop table basic_lob_table");
    catch (SQLException e)
    // An exception could be raised here if the table did not exist already
    // but we gleefully ignore it
    // Create a table containing a BLOB and a CLOB
    stmt.execute ("create table basic_lob_table (x varchar2 (30), b blob, c clob)");
    // Populate the table
    stmt.execute ("insert into basic_lob_table values ('one',empty_blob(), 'clob column data !!!')");
    // Select the lobs
    OracleResultSet rset = (OracleResultSet)stmt.executeQuery("select b from basic_lob_table where x='one' for update");
    while (rset.next ())
    // Get the lobs
    BLOB blob = ((OracleResultSet)rset).getBLOB (1);
              try
    File file = new File("c:\\temp\\bokim.txt");
    long fileLength = (long) file.length();
    System.out.println("File Size : " + fileLength + " bytes");
    FileInputStream instream = new FileInputStream(file);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    System.out.println("BufferSize: " + size + " bytes (#)\n");
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    System.out.print("#");
    System.out.println();
    instream.close();
    outstream.close();
    System.out.println("\nUpdate Done.");
    catch (java.io.FileNotFoundException fe) {
    System.err.println ("thrown: java.io.FileNotFoundException\n");
    fe.printStackTrace ();
    System.err.println (fe.getMessage ());
    stmt.close();
    conn.commit();
    conn.close();
    결과
    SQL> select dbms_lob.getlength(b) from basic_lob_table;
    no rows selected
    SQL> /
    DBMS_LOB.GETLENGTH(B)
    4328
    Reference Documment
    ---------------------

  • Reading and Writing to blob column is very slow

    Hi
    I want to write a serialized java object called 'engine' to a database table called javaObjectsDB. The serialized object could be of sizes anywhere between 20MB to 4GB. I am using the following code to write this 'engine' object
                   * Write java object to BLOB in DB - Start
                   Connection conn=null;
                   conn = Util.getConnectionFromDS();
              PreparedStatement ps=null;
              String sql=null;
                   Engine.startWatch();
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   Engine.endWatch("Time for ByteArrayOutputStream");
                   Engine.startWatch();
                   ObjectOutputStream oos = new ObjectOutputStream(baos);
                   Engine.endWatch("Time for ObjectOutputStream");
                   Engine.startWatch();
                   oos.writeObject(this.engine_);
                   Engine.endWatch("Time for oos.writeObject");
                   oos.flush();
                   Engine.startWatch();
                   byte[] data = baos.toByteArray(); // in case of using ByteArrayOutputStream
                   Engine.endWatch("Time for toByteArray");
                   Engine.startWatch();
         sql="insert into javaObjectsDB values (?)";
         ps=conn.prepareStatement(sql);
         ps.setObject(1, data); // in case of using ByteArrayOutputStream
         ps.executeUpdate();
         Engine.endWatch("Time for prepare statement and insert");
                   * Write java object to BLOB in DB - End
    To read from database BLOB column back to the engine object I use the following code:
    try {
                   String readBlob = "SELECT javaObject FROM javaObjectsDB ";
                   Statement readBlobStmt = conn.createStatement();
                   ResultSet resultSet = readBlobStmt.executeQuery(readBlob);
                   while (resultSet.next()) {
                        * ByteArrayStream *** Start
                        Engine.startWatch();
                        Blob blob = resultSet.getBlob(1);
                        Engine.endWatch("loadPlan::Time for getBlob");
                        Engine.startWatch();               
                        byte [] data = blob.getBytes(1,(int)blob.length());
                        Engine.endWatch("loadPlan::Time for getBytes");                    
                        Engine.startWatch();
                   ByteArrayInputStream bais = new ByteArrayInputStream(data);               
                   Engine.endWatch("loadPlan::Time for ByteArrayInputStream");
                   Engine.startWatch();
                   ObjectInputStream oin = new ObjectInputStream(bais);
                   Engine.endWatch("loadPlan::Time for ObjectInputStream");
                   Engine.startWatch();
                   engine_ = (Engine)oin.readObject();     
                   Engine.endWatch("loadPlan::Time for oin.readObject");
                   System.out.println("engine object prepared");
                        * ByteArrayStream *** End
                   } //while of result Set
    The time taken to write and read for a engine object of size 124MB are:
    write - 41secs
    read - 28secs
    For a engine object of size 340MB
    write - 3minutes
    read - 1minute
    This is a lot of time for such small object size, and since we are expecting sizes of 4GB, I need to have better performance. Please suggest what I can do to improve performance for read and write.
    One thing I tried was using cached lobs but not of much use.

    Welcome to the forum!
    Unfortunately this is an Oracle forum and your question should be posted in the Java JDBC forum.
    https://forums.oracle.com/forums/category.jspa?categoryID=288
    Please create a question on the JDBC forum, post a link to that new question here, in this forum, and mark this question answered.
    That way anyone seeing this question can followup with you in the other forum.
    Thanks.

  • BLOB Columns Inserts/Updates ???

    Please let me know how SQL*Loader can run updates to just the blob columns without truncation/replace. We want to do incremental updates to the BLOB column without truncation/replace. If this is not possible please let me know any other process which can do this with the best performance we have huge amount of data that needs to be processed. Please let me know .......
    e-mail from the developer.
    Is there something that we or the DBA’s can do to improve performance on these types of inserts/updates with blobs? Currently we are executing batches of inserts/update to the 5 IMAGE_* tables and those are triggering inserts into the IMAGE*_HISTORY tables                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Handle:      user01
    Status Level:      Newbie
    Registered:      Jun 10, 2004
    Total Posts:      252
    Total Questions:      28 (24 unresolved)
    so many questions & so few answers.
    EXTERNAL TABLE is available option
    How fast it is depends upon the SQL & design implementation

  • Inserts are slow if table have lots of record (400K) vs. if it's empty

    It takes 1 minute to insert 100,000 records into a table. But if the table already contains some records (400K), then it takes 4 minutes and 12 seconds; also CPU-wait jumps up and “Free Buffer Waits” become really high (from dbconsole).
    Do you know what’s happing here? Is this because of frequent table extents? The extent size for these tables is 1,048,576 bytes. I have a feeling DB is trying to extend the table storage.
    I am really confused about this. So any help would be great!

    Your DB_CACHE_SIZE is likely too small (or DBWR writing to disk is too slow).
    Since you are doing regular INSERTs (not being Direct Path with APPEND), Oracle has to find the free block for the next row and load it into the Database Cache to insert the row into it. However, as your insert more records, the "dirty" blocks still present in the cache have to be written out to disk and DBWR is unable to write out the dirty blocks quickly enough.
    What is the size of the table in USER_SEGMENTS and also as shown in
    NUM_ROWS, SAMPLE_SIZE, AVG_ROW_LENGTH from USER_TABLES ?
    What is your DB_CACHE_SIZE ?

  • How to insert a pdf or jpeg image into a blob column of a table

    How to insert a pdf or jpeg image into a blob column of a table

    Hi,
    Try This
    Loading an image into a BLOB column and displaying it via OAS
    The steps are as follows:
    Step 1.
    Create a table to store the blobs:
    create table blobs
    ( id varchar2(255),
    blob_col blob
    Step 2.
    Create a logical directory in the database to the physical file system:
    create or replace directory MY_FILES as 'c:\images';
    Step 3.
    Create a procedure to load the blobs from the file system using the logical
    directory. The gif "aria.gif" must exist in c:\images.
    create or replace procedure insert_img as
    f_lob bfile;
    b_lob blob;
    begin
    insert into blobs values ( 'MyGif', empty_blob() )
    return blob_col into b_lob;
    f_lob := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    Step 4.
    Create a procedure that is called via Oracle Application Server to display the
    image.
    create or replace procedure get_img as
    vblob blob;
    buffer raw(32000);
    buffer_size integer := 32000;
    offset integer := 1;
    length number;
    begin
    owa_util.mime_header('image/gif');
    select blob_col into vblob from blobs where id = 'MyGif';
    length := dbms_lob.getlength(vblob);
    while offset < length loop
    dbms_lob.read(vblob, buffer_size, offset, buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    end loop;
    exception
    when others then
    htp.p(sqlerrm);
    end;
    Step 5.
    Use the PL/SQL cartridge to call the get_img procedure
    OR
    Create that procedure as a function and invoke it within your PL/SQL code to
    place the images appropriately on your HTML page via the PL/SQL toolkit.
    from a html form
    1. Create an HTML form where the image field will be <input type="file">. You also
    need the file MIME type .
    2. Create a procedure receiving the form parameters. The file field will be a Varchar2
    parameter, because you receive the image path not the image itself.
    3. Insert the image file into table using "Create directory NAME as IMAGE_PATH" and
    then use "Insert into TABLE (consecutive, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval,
    EMPTY_BLOB(), 'GIF' or 'JPEG') returning BLOB_OBJECT, consecutive into variable_blob,
    variable_consecutive.
    4. Load the file into table using:
    dbms_lob.loadfromfile(variable_blob, variable_file_name, dbms_lob.getlength(variable_file_name));
    dbms_lob.fileclose(variable_file_name);
    commit.
    Regards,
    Simma........

  • Sample insert into table with BLOB column

    This is my first opportunity to work with BLOB columns. I was wondering if anyone had some sample code that shows the loading of a blob column and inserted into the table with a blob column.
    I have to produce a report (including crlf) and place it into a blob column. The user will download the report at a later time.
    Any suggestions / code samples are greatly appreciated!!!!

    You can enable string binding in TopLink.
    login.useStringBinding(int size);
    or you could enable binding in general,
    login.bindAllParameters();

  • ORA-00600 error when inserting NULL in BLOB column

    Hi,
    I want to insert NULL value into a BLOB column w/o using empty_blob(), but I am getting the following error upon submission (both through program and upon directly executing it from TOAD/SQL*):
    java.sql.SQLException: ORA-00600: internal error code, arguments: [kxtotolc_lobopt], [], [], [], [], [], [], []
    The query is as follows:
    insert into image_rendering r
    (r.Version_date_time, r.id, r.Name, r.Type, r.Image_url, r.Image_filesize, r.Html, r.Original_Text, r.Redirect_url, r.Version, r.Rendering_size) values
    (sysdate, '1963884', '468x60_1.gif', '0', '225/9-468x60_1.gif', '1471', null, null, null, '1', '30670908')
    In the table r.Html, r.Original_Text are blob and clob columns respectively.
    If I remove the column r.Html (blob) and its corresponding value the following query executes fine :
    insert into image_rendering r
    (r.Version_date_time, r.id, r.Name, r.Type, r.Image_url, r.Image_filesize, r.Original_Text, r.Redirect_url, r.Version, r.Rendering_size)
    values
    (sysdate, '1963884', '468x60_1.gif', '0', '225/9-468x60_1.gif', '1471', null, null, '1', '30670908')
    I know I can also insert the query using the string empty_blob(), but I dont want to do it without using empty_blob() since it will involve changing my generic DB classes.
    The strange thing is that I created another table involving blob and clob columns through TOAD.
    In this table I can insert NULL values in the blob column without any error.
    Is there anything that can be done to insert a NULL into my blob column? Am I missing anything?
    Is there a setting in the database that will allow me to do this? cuz one table accepts null and the other doesn't. Its strange.
    I am using Oracle8i Enterprise Edition Release 8.1.7.0.0
    The query doen't execute through toad or sql* plus or through program (I am using thin oracle drivers: the usual classes12.zip file)
    thanks in advance
    - Nilesh

    From metalink
    Oracle 9i Message~~~~~~~~~~~~~~~~~
    Error:     ORA-14400 (ORA-14400)
    Text:     inserted partition key does not map to any partition
    Cause:     An attempt was made to insert a record into, a Range or Composite
         Range object, with a concatenated partition key that is beyond the
         concatenated partition bound list of the last partition -OR- An
         attempt was made to insert a record into a List object with a
         partition key that did not match the literal values specified for
         any of the partitions.
    Action:     Do not insert the key. Or, add a partition capable of accepting
         the key, Or add values matching the key to a partition
         specification
    >
    So check the date .
    What is your insert statement.
    Anand
    Edited by: Anand... on Mar 4, 2009 5:42 PM

  • Insert Blob column in the client errors ClassCastException: oracle.sql.BLOB

    Hi,
    When I try to insert and commit a Blob column(picture) I am getting the following exception.
    Is there any jar I need to add or any other setup I need to do to accept the BLOB column in the olite client database.
    500 Internal Server Error
    javax.faces.FacesException: #{backing_XXPBWorkOrderResultsCreatePGBean.saveButton_action}: javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.sql.BLOB
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
         at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)
    Caused by: java.lang.ClassCastException: oracle.sql.BLOB
         at oracle.lite.poljdbc.LiteEmbPreparedStmt.setVal(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
         at oracle.lite.web.JupPreparedStatement.setObject(Unknown Source)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindUpdateStatement(BaseSQLBuilderImpl.java:1765)
         at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:7345)
    With regareds,
    Kali.
    OSSI.

    Here are examples if inserting into a Blob from text, file, and retrieving a blob.
    Insert into a Blob (Text)
    import java.io.FileNotFoundException;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class InsertBlob {
        public static void main(String[] args) throws FileNotFoundException {
            Connection con = null;
            PreparedStatement stmt = null;
            ResultSet rs = null;
            String letterText = "some letter text";
            long id = 100;
            try {
                DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
                try {
                    con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            try {
                stmt = con.prepareStatement("INSERT INTO BLOB_TABLE (BLOB_ID, BLOB_DATA) VALUES (?, EMPTY_BLOB())");
                stmt.setLong(1, id);
                stmt.executeUpdate();
                stmt = con.prepareStatement("SELECT BLOB_DATA FROM BLOB_TABLE WHERE BLOB_ID = ? FOR UPDATE");
                stmt.setLong(1, id);
                rs = stmt.executeQuery();
                if (rs.next()) {
                    try {
                        oracle.lite.poljdbc.BLOB oliteBlob = null;
                        oliteBlob = ((oracle.lite.poljdbc.OracleResultSet) rs).getBLOB(1);
                        byte[] byteLetterText = letterText.getBytes();
                        oliteBlob.putBytes(1, byteLetterText);
                        con.commit();
                    } catch (ClassCastException e) {
                        e.printStackTrace();
                    } finally {
                        rs = null;
                        stmt = null;
                        con.rollback();
                        con = null;
            } catch (SQLException e) {
                e.printStackTrace();
    }Insert Into a Blob (File)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    public class InsertBlobFile {
        public static void main(String[] args) throws FileNotFoundException {
            Connection con = null;
            PreparedStatement stmt = null;
            long id = 200;
            try {
                DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
                try {
                    con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            try {
                stmt = con.prepareStatement("INSERT INTO BLOB_TABLE (BLOB_ID, BLOB_DATA) VALUES (?, ?)");
                stmt.setLong(1, id);
                File fBlob = new File ( "C:\\BLOB_TEST_FILE.TXT" );
                FileInputStream is = new FileInputStream ( fBlob );
                stmt.setBinaryStream (2, is, (int) fBlob.length() );
                stmt.executeUpdate();
                con.commit();
            } catch (SQLException e) {
                e.printStackTrace();
    }Retrieve from Blob (Write to file)
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class RetrieveBlob {
        final static int bBufLen = 32 * 1024;
        final static String outFile = "C:\\BLOB_OUTPUT_FILE.TXT";
        public static void main(String[] args) throws IOException {
            Connection con = null;
            PreparedStatement stmt = null;
            ResultSet rs = null;
            try {
                DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
                try {
                    con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            try {
                stmt = con.prepareStatement("SELECT * FROM BLOB_TABLE");
                rs = stmt.executeQuery();
                while(rs.next()) {
                    int id = rs.getInt(1);
                    Blob value = rs.getBlob(2);
                    System.out.println(id + " | " + value);
                    writeBlobToFile(value);
            } catch (SQLException e) {
                e.printStackTrace();
        public static long readFromBlob(Blob blob, OutputStream out)
          throws SQLException, IOException {
            InputStream in = blob.getBinaryStream();
            int length = -1;
            long read = 0;
            byte[] buf = new byte[bBufLen];
            while ((length = in.read(buf)) > 0) {
                out.write(buf, 0, length);
                read += length;
            in.close();
            return read;
        public static long writeBlobToFile(Blob blob)
          throws IOException, SQLException {
            long wrote = 0;
            OutputStream fwriter = new FileOutputStream(outFile);
            wrote = readFromBlob(blob, fwriter);
            fwriter.close();
            return wrote;
    }

  • Blob column slow after upgrade from 9i to 11g

    Hello, I recently upgraded 9i to 11g and the insert for blob column in one of the table is now really slow. can anyone help me please? thanks

    Welcome to the forums !
    It would be best to trace the insert statement. Pl see these threads on how to post a tuning request -
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long ...
    HTH
    Srini

  • Problem inserting large files into a Blob-Column

    hi all,
    i am using a oracle 10g database.
    i defined a table including one blob column as follows:
    create table contact(
    id     number(22) primary key not null,
    lastupdated date not null,
    lastwriter_id number(22) not null,
    contacttype_id number(22) not null,
    notice varchar2(2000),
    attachment blob,
    attachmentname varchar2(255))
    tablespace users
    storage (initial 2M pctincrease 0)
    lob (attachment) store AS (
    tablespace users
    storage (initial 10M)
    enable storage in row
              pctversion 5
              chunk 1
    index lob_attachment_idx (tablespace users storage (initial 1M)));
    now i fill this table from a java application using hibernate.
    small files (for example 2700 chars) are ok, the pass into the attachment column.
    larger files dont go there. i receive no errormessage.
    whats going wronr?
    ist my create table statement wrong?
    thnax for help dieter

    Quick and dirty testcase:
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> drop table t;
    Table dropped.
    test@ORA10G> create table t (x blob);
    Table created.
    test@ORA10G>
    test@ORA10G> insert into t (x)
      2  select utl_raw.cast_to_raw(rpad('a',1000,'x')) from dual;
    1 row created.
    test@ORA10G>
    test@ORA10G> commit;
    Commit complete.
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> select dbms_lob.getlength(x) as len, dbms_lob.substr(x,10,1) as chunk from t;
           LEN CHUNK
          1000 61787878787878787878
    test@ORA10G>
    test@ORA10G>pratz

  • Error when inserting  file 4KB in a BLOB column.

    Hello,
    I am getting the following error when I am trying to insert a file > 4KB in a
    BLOB column.
    ORA-01461: can bind a LONG value only for insert into a LONG column.
    We are using Weblogic5.1.0 sp10, Oracle 8.0.5 with WL OCI driver.
    There is no change even after setting the following property weblogic.oci.min_bind_size=660
    Please can anyone help?
    Thanks.

    Hello,
    I tried using the following sql stmts to override the NLS_LANG setting on both
    server and client for a session.
    ALTER SESSION SET NLS_LANGUAGE = AMERICAN;
    ALTER SESSION SET NLS_TERRITORY = AMERICA;
    It still gave the same error.
    I tried the same using Oracle thin driver.Even then the same problem.
    As I mentioned earlier, we are using oracle 8.0.5.
    and here is the code I am using for writing BLOB data
    java.sql.PreparedStatement prepstmt = conn.prepareStatement("Update TEST_BLOB
    set BLOBATTACH = ? where IDX =1");
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeObject(data);
    prepstmt.setBinaryStream(1, new ByteArrayInputStream(ostream.toByteArray()), ostream.size());
    prepstmt.executeUpdate();
    prepstmt.close();
    Any suggestions ?
    Thanks.
    "Slava Imeshev" <[email protected]> wrote:
    Latha,
    You need to make sure you have the same NLS_LANG setting both for the
    client
    and the server.
    Regards,
    Slava Imeshev
    "Latha Pusapaty" <[email protected]> wrote in message
    news:[email protected]...
    I Tried that. But still getting the same exception.
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insertinto a
    LONG column
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java:980)
    atweblogic.jdbc20.pool.PreparedStatement.executeUpdate(PreparedStatement.java:
    47)
    atweblogic.jdbc20.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedSta
    tementImpl.java:54)
    atweblogic.jdbc20.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStat
    ement.java:55)
    at fictx.TRServlet.doPost(TRServlet.java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, CompiledCode)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, CompiledCode)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    Compiled Code)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java,
    Compiled Code)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,Compiled
    Code)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,Compiled
    Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
    Same code is working fine for files less than 4000 bytes.
    Oracle table has only one BLOB column.
    I have set weblogic.oci.selectBlobChunkSize=1200 .
    Where could be the problem?
    Andreas Bittorf <[email protected]> wrote:
    We resolved the problem as following:
    ps = con.prepareStatement
    ("update tq_businessmodel set
    businessmodel=?,lastupdate=?
    "WHERE taskid=?");
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeObject(businessModel);
    ps.setBinaryStream(1, newByteArrayInputStream(ostream.toByteArray()),
    ostream.size());
    ps.setTimestamp(2,new Timestamp(System.currentTimeMillis()));
    ps.setLong(3,taskid);
    ps.executeUpdate();

  • How to insert data in BLOB column??

    How to insert data in BLOB column.
    Create table BLOBTest (message BLOB)
    insert into blobtest
    (message)
    values
    ('I am loving it');
    gives error ORA-01465: invalid hex number.

    ('I am loving it');This is not considered Binary (BLOB) data. Are you sure you don't want a Character (CLOB) column?

  • I have a question for you: Inserting Word document in BLOB column

    Hey Experts,
    I have found a good info and a sample on how to achieve this on
    http://www.sys-con.com/java/source/5-6/code.cfm?Page=76.
    declare
    f_lob bfile;
    b_lob blob;
    begin
    insert into sam_emp(empno,ename,resume)
    values ( 9001, 'Samir',empty_blob() )
    return risumi into b_lob;
    f_lob := bfilename( 'MY_FILES', 'MyResume.doc' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile
    ( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    I have a jsp project and the users ( on the client side)must be
    able to create a word document and send it to the server with an
    uplaod servlet. With another servlet or jsp i want to process
    this word document in BLOB column using JAVA. The sample above
    uses PL/SQL to achieve this. Is there a way i can do this in my
    servlet/jsp to do the same thing?
    Any hints are welcome!

    The option should be visible here: http://support.mozilla.com/en-US/kb/Printing%20a%20web%20page#w_print-window-settings
    Print range section - Lets you specify which pages of the current web page are printed:
    * Select '''All''' to print everything.
    * Select '''Pages''' and enter the range of pages you want to print. For example, selecting "from 1 to 1" prints the first page only.
    * Select '''Selection''' to print only the part the page you've highlighted.
    Does it work for you?

  • How to read a XML file from BLOB column and insert in a table - PL/SQL Only

    Hi,
    To make data load more simple to end user instead placing file on the server and use SQL-LOADER, I came up with new idea that using oracle ebusiness suite attachment functionality. that loads a XML file from local PC to a database column(table is fnd_attachments, default data type is BLOB over here).
    I tried with DBMS_LOB and didnt get around.
    Please can anyone tell me how to read the BLOB column using PL/SQL and store the data in a oracle table. Here's the sample XML file and table structure FYI.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Corporate_alloc.xsd" generated="2009-07-07T14:17:49">
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080543758</DET_CODE>
    <DET_NAME>Waves, Tides and Shallow-Water Processes</DET_NAME>
    <ALLOCATION_RATIO>0.000041</ALLOCATION_RATIO>
    </Corporate_alloc>
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080534343</DET_CODE>
    <DET_NAME>Hydrostatically Loaded Structures</DET_NAME>
    <ALLOCATION_RATIO>0.000127</ALLOCATION_RATIO>
    </Corporate_alloc>
    </dataroot>
    CREATE TABLE TEST_XML
    ( PKG_CODE VARCHAR2(50),
    PKG_NAME VARCHAR2(100),
    DET_CODE VARCHAR2(20),
    DET_NAME VARCHAR2(500),
    ALLOCATION_RATIO NUMBER )
    Thanks
    EBV

    In regards to #3, use the COLUMNS functionality of XMLTable instead of using Extract. Two simple examples are
    Re: XML Data - Caliculate fields
    Re: Extractvalue function not recognised

Maybe you are looking for