Problem with Blob

Hi to all
My JDBC driver not supports getBlob();
My code is
//reading blob1
mResultSet=mStatement.executeQuery("Select blob1 from table1");
mResultSet.next();
InputStream is = mResultSet.getBinaryStream("blob1");
//writing blob2
String mm="UPDATE table2 set blob2=?";
PreparedStatement pp=connection.prepareStatement(mm);
pp.setBinaryStream(1, is, is.available());
pp.executeUpdate();
Can somebody say why I can read blob1 (it is not null), but when I try read blob2 (after executing this code), i retrieve empty BinaryStream - null?
Thanks

Thanks very much Martin for reply,
But I can't understand this:
You wrote:
InputStream is = new InputStream(mResultSet.getBinaryStream("blob1");I write
InputStream is = mResultSet.getBinaryStream("blob1");
Now I think I have Input Stream with data or I'm wrong?
Maybe in this InputStream I have only Adress and no data?
byte[] buf = new byte[MAX_LENGTH];
is.read(buf, 0, buf.length);with these program reads data from InputStream to byte[].Why I must do it?
//Following API:
//setBinaryStream(int parameterIndex, InputStream x, int length)
I must write:
pp.setBinaryStream(1, is, is.available());
//pp is Prepered Statement; is - InputStream.
When I write
byte[] buf = new byte[MAX_LENGTH];
int IS_length=is.read(buf, 0, buf.length);
I get IS_length=8 and is.available()=8
Regards,
Sigis

Similar Messages

  • Problem with BLOB data type and acute characters

    Hi all, I have an issue related with BLOBS cols:
    I have table A with a BLOB column and I need to insert that data into another table B, the thing is I use dbms_lob.read() that returns data into a RAW variable and then I convert it to a varchar2(with utl_raw.cast_to_varchar2) and it works ok if I have no "acute characters" on it, e.g Québec.
    If I have acute characters, the "é" is inserted wrongly with an "¿" character on the table B. I tested the BLOB on the table A to check the data and the BLOB is showing correctly the "é" character, it seems that the dbms_lob.read() funct cannot handle accute characters and replace them with "¿".
    How can I replace acute characters when I use the dbms_lob.read functionality?
    Thank you!

    what's the OS of the db server? is this code an anonymous pl/sql block, or stored pl/sql? does it run on the server or a client? if it's on the client, what's the o/s of the client?
    you might want to look at the following, plus the first 3 notes in it's reference section
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:3038746456038321058::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,264157.1,1,1,1,helvetica

  • Weird Problem with BLOB CMP field

    Hi,
    I am trying to deploy an EJB2.0 CMP Bean in Weblogic6.1 .The Bean has one of the CMP Field as a serializable object mapped to a BLOB Datatype in Oracle8i
    When i try to creae this Entity Bean
    I get "java.io.IOException: ORA-22920: row containing the LOB value is not locked" as a nested exception.
    When i increased the isolation level . I got "java.io.IOException: ORA-01002 fetch out of sequence" as the nested exception
    And one more horrible thing that is happening is the other arguments to the create method are getting updated in the DB except the Blob field(Supposed to rollback? when there is an EJB Exception ??)
    Any thoughts? Comments?
    Regards
    Sathya

    Hi,
    I seem to recall that there are multiple issues with BLOBS & WLS. I'll describe my setup, and you can see if your missing anything:
    - In weblogic-cmp-rdbms-jar.xml you need to set the column type as a Blob:
    <field-map>
    <cmp-field>binary</cmp-field>
    <dbms-column>binary</dbms-column>
    <dbms-column-type>OracleBlob</dbms-column-type>
    </field-map>
    - In weblogic-ejb-jar.xml you may need to set the isolation level of your set method:
    <transaction-isolation>
    <isolation-level>TRANSACTION_READ_COMMITTED_FOR_UPDATE</isolation-level>
    <method>
         <ejb-name>TerminalSoftwareKernelBDO</ejb-name>
         <method-name>setBinary</method-name>
    </method>
    </transaction-isolation>
    - The bean get/set methods should look like this:
    public abstract void setBinary(java.lang.Object binary);
    public abstract java.lang.Object getBinary();
    - In WLS 6.1 up to Service Pack 2 (I don't know about SP3 yet), BLOBs are incorrectly implemented. For some (odd) reason you can only put serialized objects into the DB... I think this means that if you have a BLOB put in by anything but WLS, WLS get very unhappy. So empty out your table with the blobs first.
    Hope that helps.
    Daniel.

  • Problem with blobs larger than (about) 2kb

    Hello,
    I try to insert binary files with java (jdbc) into tables in my 9i database, and small files with e.g. 500bytes are no problem, but files with 3 or more kbytes are not inserted yet. I got no sql-exception. It simply seems not written into my table.
    This is the SQL I used to create the table:
    create table tblblob2 (
    name varchar2(30),
    content blob)
    lob (content) store as glob_store (
    tablespace LOBSPACE_1
    storage (initial 100k next 100k pctincrease 0)
    chunk 4
    pctversion 10
    INDEX glob_index (
    tablespace raw_index))
    TABLESPACE LOBSPACE_1
    storage (initial 1m next 1m pctincrease 0);
    insert into tblblob2 (name) values ('Test')
    Before this I already tried a very simple create-statement, but it wouldnt work ,too. Thats why I tried this lob...
    And then I used java to update this row:
    DbConnectionHandling dbConnection = new DbConnectionHandling();
              dbConnection.connect();
              FileInputStream fis = null;
              Connection cn = dbConnection.connection;
              PreparedStatement st = null;
              try {
              File fl = new File( FILE ); // imgFile
              fis = new FileInputStream( fl );
              st = cn.prepareStatement( "update tblblob2 set content = ? where (name = 'Test')" );
              st.setBinaryStream( 1, fis, (int)fl.length() ); // imgFile
              st.executeUpdate();
              System.out.println( fl.length() + " Bytes successfully loaded." );
              } catch( SQLException ex ) {
                   System.out.println("0: " + ex.getMessage());
              } catch( IOException ex ) {
                   System.out.println("0: " + ex.getMessage());
              } finally {
              try {
                   if( null != st ) st.close();
              } catch( Exception ex ) {
                   System.out.println("1: " + ex.getMessage());
              try {
                   if( null != cn ) cn.close();
              } catch( Exception ex ) {
                   System.out.println("2: " + ex.getMessage());
              try {
                   if( null != fis ) fis.close();
              } catch( Exception ex ) {
                   System.out.println("3: " + ex.getMessage());
    With small files it works, but whats wrong with "larger" files?
    I need fast help...
    Thanks, Nick

    No Ideas? May it perhaps be a restriction of db-admin?

  • Problem with BLOB fields (DBMS_LOB)

    I want to read a word document from hard disc and save it into a BLOB field with using DBMS_LOB package. but when using it I always receive error "Invalid LOB locator specified" even I use oracle examples.
    I use FormBuilder 6.0.
    How can I do this. plz give me a code.
    Thanks so much

    >
    help plzzz
    >
    If you want help in the forum you need to use English when you post.
    You also need to actually ask a question or present the issue that you need help with. Just saying you nave a problem and then posting code isn't sufficient.
    Please edit your post and provide the English version of your code, comments, error messages and your action question or issue.

  • JDBC performance problem with Blob

    Hi,
    I've some performance problem while inserting Blob in an Oracle
    8i database. I'm using JVM 1.17 on HP-UX 11.0 with Oracle thin
    client
    The table I used contains only two columns : an integer (the
    primary key) and a blob.
    First I insert a row in the table with an empty_blob()
    Then I select back this row to get the blob
    and finally I fill in the blob with the data.
    But it takes an average 4.5 seconds to insert a blob of 47 Kb.
    Am I doing something wrong?
    Any suggestion or hint will be welcome.
    Thanks in advance
    Didier
    null

    Don S. (guest) wrote:
    : Didier Derck (guest) wrote:
    : : Hi,
    : : I've some performance problem while inserting Blob in an
    Oracle
    : : 8i database. I'm using JVM 1.17 on HP-UX 11.0 with Oracle
    thin
    : : client
    : : The table I used contains only two columns : an integer (the
    : : primary key) and a blob.
    : : First I insert a row in the table with an empty_blob()
    : : Then I select back this row to get the blob
    : : and finally I fill in the blob with the data.
    : : But it takes an average 4.5 seconds to insert a blob of 47
    Kb.
    : : Am I doing something wrong?
    : : Any suggestion or hint will be welcome.
    : : Thanks in advance
    : : Didier
    : In our testing if you use blob.putBytes() you will get better
    : performance. The draw back we found was the 32k limit we ran
    in
    : to. We had to chunk things larger than that and make calls to
    : the append method. I was dissappointed in Oracle's phone
    support
    : on what causes the 32k limit. In addition the getBytes() for
    : retrieve doesn't seem to work. You'll have to use the
    : InputStream for that. Oh, and FYI. We ran into a 2k limit on
    : putChars() for CLOB's.
    the thin drivers currently use the package "dbms_lob" behind the
    scenes while the jdbc oci 815 drivers and higher uses the native
    oci calls which makes them much faster.
    there also is a 32k limit on pl/sql stored procedures/functions
    for parms.
    you may have run into that.
    null

  • Typical problem with BLOB.

    while i am using blob to store file content
    (for word documents more than 400 kb) iam facing this error.
    java.sql.sqlexception : ORA-01401:INSERTED VALUE TOO LARGE FOR COLUMN
    if it is some pdf files more than this size it is uploading.
    pls help me in this regard.
    Thanks in advance....

    >
    help plzzz
    >
    If you want help in the forum you need to use English when you post.
    You also need to actually ask a question or present the issue that you need help with. Just saying you nave a problem and then posting code isn't sufficient.
    Please edit your post and provide the English version of your code, comments, error messages and your action question or issue.

  • Oracle Rdb Driver 3.1.0.0 problem with blobs

    I am trying to convert an MsAccess application to use an MsAccess front end and an Oracle Rdb back end.
    I've created the test database under VMS and can successfully link to the Oracle Rdb tables from MSAccess 2000. One of the main reasons for converting to Oracle Rdb is to be able to store large word documents in the database. I was able to do that using Oracle rdb Driver v 3.00.02.06. I recently converted to Oracle Rdb Driver version 3.1.0.0 and can no longer access the Blob field containing the Word document. MsAccess now sees this field as type ‘Binary’ and I keep getting an ‘invalid field type’ error. (with 3.00.02.06 this field was seen by MsAccess as an ‘Ole Object’ and the getchunk and appendchunk functions for getting and saving a blob worked reasonably well).
    Is this a bug in 3.1.0.0 or is there some way to get MsAccess to recognize this Binary field type?

    I suspect you'll need to contact Oracle support on this. There aren't, to my knowledge, any RDB folks around here.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Problem with Blob key legnth in MySQL & JBoss

    Hi,
    I am using MySQL 3.23.55, JBOSS 3.0.6, EJB 2.0, CMP 2.0
    I have configured the database, the tables are created but it stops at one place.In the type mappings-mappings , i have the following in the standardjbosscmp-jdbc.xml
    java-type jdbc-type sql-type
    java.lang.Object Blob LongBlob
    I get the following error while creating one of the fields at the time of deployment.
    org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (java.sql.SQLException: General error, message from server: "BLOB column 'start_ip' used in key specification without a key length")
    I have searched on the net and came up with the following,
    it seems that we need to specify the column legnth in the create table statement. I would have to use the following
    CREATE INDEX part_of_name ON customer (name(10))
    if i was directly working on the database @ command line.
    But i am using CMP, so how do i fix this ?
    Any help is appreciated
    Regards
    Meka Toka

    That is what i said in my post
    I have searched on the net and came up with the following,
    it seems that we need to specify the column legnth in the create table statement. I would have to use the following
    CREATE INDEX part_of_name ON customer (name(10))
    if i was directly working on the database @ command line.
    My question now is
    how do i do this in CMP
    Regards
    Meka Toka

  • Problem with BLOB image retrieval

    We are on Coldfusion 9,0,1,274733. I checked on "Enable binary large object retrieval (BLOB)" on the database but the image is still cut off (3/4 partly grey). On our dev server it works perfectly, our production server just gives off the partly grey images. I checked the CF database settings between dev and production and they are exactly the same. We restarted the server but still the same problem. It is like Coldfusion doesn't see the setting changes. Anyone else has this problem?

    We found the solution. Our production servers are in a clustered environment. You have to enable "Enable binary large object retrieval (BLOB)" at the instance cluster level. You will have to do this change on all the instances in the cluster. I was only enabling it at the "local" level on each server in the cluster (which didn't work).
    In CF Admin:
    Enterprise Manager > Instance Manager > select the instance and enable BLOB

  • Problem with blob column index created using Oracle Text.

    Hi,
    I'm running Oracle Database 10g 10.2.0.1.0 standard edition one, on windows server 2003 R2 x64.
    I have a table with a blob column which contains pdf document.
    Then, I create an index using the following script so that I can do fulltext search using Oracle Text.
    CREATE INDEX DMCS.T_DMCS_FILE_DF_FILE_IDX ON DMCS.T_DMCS_FILE
    (DF_FILE)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('DATASTORE CTXSYS.DEFAULT_DATASTORE');
    However, the index is not searchable and I check the following tables created by database for my index and found them to be empty as well !!
    DR$T_DMCS_FILE_DF_FILE_IDX$I
    DR$T_DMCS_FILE_DF_FILE_IDX$K
    DR$T_DMCS_FILE_DF_FILE_IDX$N
    DR$T_DMCS_FILE_DF_FILE_IDX$R
    I wonder what's wrong with it.
    My user has been granted the ctx_app role and I have other tables that store plain text which I use Oracle Text are fine. I even output the blob column and save as pdf file and they are fine.
    However the database seems like not indexing my blob column although the index can be created without error.
    Please advise.
    Really appreciate anyone who can help.
    Thank you.

    The situation is I have already loaded a few pdf document into the table's blob column.
    After I create the Oracle text index on this blob column, I find the system generated index tables listed in my earlier posting are empty, except for the 4th table.
    Normally we'll see words inside the table where those are the words indexed by oracle text on my document.
    As a result, no matter how i search for the index using select statement with contains operator, it will not give me any result.
    I feel weird why the blob is not indexed. The content of the blob are actually valid because I tested this by export the content back to pdf and I can still view and search within the pdf.
    Regards,
    Jap.

  • Toplink with mysql: problem with blob size

    I'm using toplink with a mysql database. I want to store some data in a blob.
    In mysql there exist different sizes of blobs (in my case I need a mediumblob).
    But if I create the scheme for the database with jpa/toplink it alway creates only a column with type blob.
    I can explicitly tell the database to use a mediumblob by this:
    @Column("MEDIUMBLOB")
    But by doing this I limit my program to mysql of course, as this data type is not known to other databases.
    Does anybody know a more elegant solution to setting the blob size?
    for example with hibernate it can be done this way:
    @Column(length=666666)

    Looks like you are using JPA, and in JPA you would set the columnDefinition to the type that you want, e.g.
    @Lob
    @Column(name="BLOBCOL", columnDefinition="MEDIUMBLOB")
    byte[] myByteData;
    As you mentioned, this does introduce a dependency on the database. However, you can always either put the Column metadata in XML, or override it with something else later in XML.
    The length attribute was intended and specified for use with Strings but I guess there is no reason why it couldn't be used for BLOBs as well (please enter an enhancement request, or submit the code to add the feature to EclipseLink). Be aware, though, that doing so at this stage is going to be introducing a dependency on the provider to support a non-spec defined feature.

  • "Long fetch" problem with BLOBs

    When I try to read BLOB fields from foreign database (Interbase) (in PL/SQL server code), I often got this error. After increasing HS_RPC_FETCH_SIZE and HS_LONG_PIECE_TRANSFER_SIZE it stops happening.
    But in Forms when reading into Image item it still appears from time to time.
    Any ideas what it depends from or how to solve this problem?

    No Ideas? May it perhaps be a restriction of db-admin?

  • Problems with BLOBs

    So I follow the tutorial here:
    http://img.photobucket.com/albums/v53/telegramsam17/epicfail.jpg
    And I end up with this error:
    http://img.photobucket.com/albums/v53/telegramsam17/epicfail2.jpg
    I'm sure it's something boneheadedly obvious, but I'm not seeing it.
    (And in my defense, I am not a database developer, I'm just developing a database because I'm a sucker who works for state government and pulled the booby prize on this one. I got my degree in Geology, kids, and this ain't rocks. ;-;)

    I can read what it says, I just don't know why it's doing that or how to make it stop doing it, hence I asked for help. I set it up identically to the tutorial (which I just took a screencap of the section I was referring to because page itself is lengthy. The whole page is here: http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm).
    This is the table I'm pulling from:
    CREATE TABLE "INDIV_PHOTO"
    (     "INDIV_PHOTO_ROW_ID" NUMBER NOT NULL ENABLE,
         "CONTACT_ID" NUMBER NOT NULL ENABLE,
         "PHOTO" BLOB,
         "FILENAME" VARCHAR2(255),
         "MIMETYPE" VARCHAR2(255),
         "LAST_UPDATE_DATE" DATE,
         CONSTRAINT "INDIV_PHOTO_PK" PRIMARY KEY ("INDIV_PHOTO_ROW_ID") ENABLE
    ALTER TABLE "INDIV_PHOTO" ADD CONSTRAINT "INDIV_PHOTO_FK1" FOREIGN KEY ("CONTACT_ID")
         REFERENCES "BGCORE"."TBL_CONTACTS" ("CONTACT_ID") ENABLE
    CREATE OR REPLACE TRIGGER "BI_INDIV_PHOTO"
    before insert on "INDIV_PHOTO"
    for each row
    begin
    if :NEW."INDIV_PHOTO_ROW_ID" is null then
    select "INDIV_PHOTO_SEQ".nextval into :NEW."INDIV_PHOTO_ROW_ID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_INDIV_PHOTO" ENABLE
    /

  • Problem with BLOB Data Type

    Dear all
    I am using APEX 4.0, to show an image in my report I have this sql statement (built by using wizard) :
    SELECT ProductID, Pro_Name, Pro_Description, Pro_Quantity, Pro_SerialNo, Pro_ModelName, Pro_ModelNo, Pro_Retail, dbms_lob.getlength(Pro_Image)
    FROM Products
    but for the Image column in the report it only shows the numbers!
    any help?
    thanks
    Maz

    Check the Format-Mask of your image report column. To display images there should be a small link next to the format mask input item, where you can specify where to read the image from.
    See this documentation for some explanation: http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at
    Training: http://www.click-click.at/apex-4-0-workshops

Maybe you are looking for

  • Blu-ray DVD no longer recognized by HP MediaSmart or Windows Media Player

    I have the HP Pavilion Elite HPE 250-f desktop computer. This computer includes a CD/DVD/Blu-ray drive. I bought this computer in 2010, and all these years I have successfully played CDs and DVDs on the computer. Until now, I have not attempted to pl

  • An extension automatically installs every time i start firefox

    An extension from local system automatically installs every time I start Firefox after PC restart. I tried to disable it, remove it, but again after restart, it appears there. My question is how to disable addition of extensions and plugins from loca

  • Different mail ID for different workflows

    Hi All, As per my knowledge if we use mail task in work flow a e-mail will be triggered from mail ID maintained for user wf_batch , is there any way to send mail through different mail iD for different workflows by using mail tasks only, not by using

  • Windows 2008 R2 SP1 Enterprise TS Sessions stuck in Down state

    I have an environment of 30 physical Windows 2008 R2 SP1 Enterprise servers providing Remote Desktop services running Citrix XenApp 6.5.  Over the last 2 months, I've had two instances where one user session was stuck in a "Down" state.  The user cou

  • MacBook Pro with 13-inch Retina Display RAM Failure?

    Hi there! I just bought a new MacBook Pro with 13-inch Retina Display on Christmas at an Apple Retail Store, and I was experiencing some lag.  The lag occurred when creating simple graphical animations, like swiping to reveal Mission Control.  So I t