Updating a blob field in access db

hi all
i need to update a blob field (containing images) in an access db
i tried with this code but didn't work:
PreparedStatement ps=c.prepareStatement("UPDATE "+tab_name+" SET "+col+" = ? WHERE "+key+"="+key_val);
                        ps.setBytes(1, rs.getBytes("F_VAL"));anyone could help me?
thanx
sandro

ok, i changed my code in this way:
ResultSet rs2=to.executeQuery("SELECT * FROM TABLE WHERE KEY= 'mykey'");
                            if(rs2.next())
                                Blob blob=rs2.getBlob("F_VAL");
                                InputStream in=blob.getBinaryStream();
                                rs2.updateBinaryStream(col, in, in.available());       
                                rs2.updateRow();
                            }and nothing happens, my file in this row isn't updated!!!
if i write
ResultSet rs2=to.executeQuery("SELECT * FROM TABLE WHERE KEY= 'mykey' for update");i get an SQLEXception that tell me that access can't implement this feature
anyone could help me?
it's not possible to update a Blob in access?
thanks

Similar Messages

  • Problem with update of BLOB field in a table with compound primary key

    Hi,
    I've been developing an application in Application Express 3.1.2.00.02 that includes processing of BLOB data in one of the tables (ZPRAVA). Unfortunately, I've come across a strange behaviour when I tried to update value in a BLOB field for an existing record via a DML form process. Insert of a new record including the BLOB value is OK (the binary file uploads upon submiting the form without any problems). I haven't changed the DML process in any way. The form update process used to work perfectly before I'd included the BLOB field. Since than, I keep on getting this error when trying to update the BLOB field:
    ORA-20505: Error in DML: p_rowid=3, p_alt_rowid=ID, p_rowid2=CZ000001, p_alt_rowid2=PR_ID. ORA-01008: not all variables bound
    Unable to process row of table ZPRAVA.
    OK
    Some time ago, I've already created another application where I used similar form that operated on a BLOB field without problems. The only, but maybe very important, difference between both the cases is that the first sucessfull one is based on a table with a standard one-column primary key whereas the second (problematic one) uses a table with compound (composite) two-column PK (two varchar2 fields: ID, PR_ID).
    In both cases, I've followed this tutorial: [http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm]).
    Can anybody confirm my suspicion that Automatic Row Processing (DML) can be used for updating BLOB fields within tables with only single-column primary keys?
    Thanks in advance.
    Zdenek

    Is there a chance that the bug will be included in the next patch?No, this fix will be in the next full version, 3.2.
    Scott

  • Problem with ojdbc14.jar (oracle10g Rel. 2 driver) in updating a BLOB field

    Hello All,
    Our web application uses oracle10g Release 2 jdbc driver with websphere 5.1.1.4 and oracle 9i. When it tries to update a BLOB field in the database updation is successful but it is updating that field with a null value. So rest of our application fails as this value is becoming null. We use an entity bean to update this table and websphere uses a prepared statement to update this table. Just before setting this BLOB field using setBinaryStream() on prepared statement I am printing to see whether it is null or not as shown in the code snippet below. And it is printing it correctly as non null. But after execution of the prepared statement some how the value stored in database is null.
    Is this a known issue with this driver? Does any one know work around or a solution to this? We have 3 BLOB fields in that table. Is that a problem? If we separate these BLOB fields into separate tables will the problem be solved? Any input on this is very much appreciated.
    // For column ORIGINAL_CONTENT
    byte[] tempbyteArray;
    tempbyteArray=(byte[])inputRecord.get(25);
    if (tempbyteArray == null) {
    System.out.println("DqPageBeanFunctionSet_f9c724af: tempbyteArray NULLLLLLL");
    } else {
    System.out.println("DqPageBeanFunctionSet_f9c724af: orig tempbyteArray length: " + tempbyteArray.length);
    if(tempbyteArray != null) {
    pstmt.setBinaryStream(25,new java.io.ByteArrayInputStream(tempbyteArray),tempbyteArray.length);
    else pstmt.setNull(25,java.sql.Types.BLOB);
    Thanks & Regards,
    -Sunitha

    I have similar problem and I solved it using ojdbc14.jar oracle9i version.
    try...

  • Update Yes/No field in access table through oracle procedure

    Hi,
    How to update Yes/No field in access table through oracle procedure. all other fields like AutoNumber, Text I can update it. Yes/No field how to update? Please, any one can help me?
    Thanks and Regards,
    Sudha.

    Sudha Teki wrote:
    select "fldPost" from tblPHd@ODBCLNKNot quite sure what you mean, but the way you select the column would indicate a case sensitive column name
    Look at this example
    SQL> create table t
      2  ("this" varchar2(10))
      3  /
    Table created.
    SQL> insert into t values ('hello')
      2  /
    1 row created.
    SQL> select *
      2    from t
      3  /
    this
    hello
    SQL> select this
      2    from t
      3  /
    select this
    ERROR at line 1:
    ORA-00904: "THIS": invalid identifier
    SQL> select "this"
      2    from t
      3  /
    this
    helloIs your column name also case sensitive?

  • Inserting and updating a BLOB field

    Friends I want my application (Oracle is the backend) to look for a character in a BLOB field and then replace it with the desired character.
    Can some one give me some example of retrieving and updating a BLOB field

    Examples are in Oracle Technet: http://otn.oracle.com/
    In this forum I saw also some examples and in your local Oracle Client Installation you find under $ORACLE_HOME$/jdbc/demo/ examples.
    reagrds Dietmar

  • Update a currency field in Access

    When I enter .50 on the form the results in the database is
    1.00. If I change 1.00 to 2.00 the change is sent to the database.
    The problem seems to be that the database is rounding the field.
    For this particular application the user needs to be able to enter
    amounts as small as .25. The field in the database is set to
    currency with 2 decimal places.
    The update code follows. Thank you in advance for your help.

    I changed the cfqueryparam tag as follows:
    fee_amount = <cfqueryparam value="#form.fee_amount#"
    cfsqltype="cf_sql_decimal" />,
    I thought this would sovle the probme, however, I receive
    this error now:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver]Optional feature
    not implemented
    The error occurred in
    C:\Inetpub\wwwroot\spl_web_site\public_records\staff_forms\update.cfm:
    line 33
    31 : staff_fname = <cfqueryparam
    value="#form.staff_fname#" cfsqltype="cf_sql_varchar" />,
    32 : staff_ph_ext = <cfqueryparam
    value="#form.staff_ph_ext#" cfsqltype="cf_sql_varchar" />
    33 : WHERE cust_id = <cfqueryparam value="#form.cust_id#"
    cfsqltype="cf_sql_numeric" />
    34 : </cfquery>
    35 :
    Now there seems to be an error on the cust_id field which is
    an auto number in the database.

  • BLOBDestination. Problem in updating BLOB field

    hi,
    Im trying to customize BLOBDestination package to update a BLOB field. So I modified the method insertBLOB replacing the insert statement with this
    stmtStr = "UPDATE " + " " + tab + " " + "SET "+ "'" blobCol "'=" + "'" + "empty_blob()" + "'"+ "WHERE " + "'"+keyCol+"'=" + "'" + key+ "'" ;
    stmt.executeUpdate(stmtStr);
    calling BLOBDestination from form I got this stmtStr:
    UPDATE MYTABLE SET blob_field=empty_blob() WHERE col1 = 'val1' (copied from OC4J_BI_Forms log file)
    but the execution returns this error:
    REP-50125: blobdestination : exception: java.sql.SQLException: ORA-00933: SQL command not properly ended
    I can affirm that the statement works if executed from TOAD or SQL*Plus
    what's wrong?

    It depends on how you have your table control set up.  When you say that you are updating the table control field, are you updating the value of the field wherever the table control data is being pulled from (I.e. the original table)?  Or are you updating the value in the internal table that is part of the table control definition (I.e. the field shown within the table control if you look at the screen layout)?  Make sure that if you are changing the data in the original table that you then also update the actual table control fields as well.  Also, are you making your changes in the PBO module before the screen is ever displayed?  You may need to use a MODIFY SCREEN statement after you make your changes, depending on when your code is called.  I hope this helps.
    - April King

  • Error displaying a jpg file loaded into a table with blob field

    This may not be the correct forum for this question, but if it isn't could someone direct me to the correct one.
    I have created a table with a blob field in which I have loaded a jpg image. This appeared to work correctly, but when I try to display the image in internet explorer it comes back and tells me that it doesn't recognize the file type. Enclosed is the table create, load, and display pl/sql code. Can anyone tell me what I am doing wrong. Thanks. For the mime/header I used owa_util.mime_header('images/jpg') because my image is a jpg file.
    The database is 10g
    -- Create table
    create table PHOTOS
    IMAGEID NUMBER(10),
    IMAGE BLOB,
    IMAGE_NAME VARCHAR2(50)
    load image
    CREATE OR REPLACE PROCEDURE load_file ( p_id number, p_photo_name in varchar2) IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := bfilename('SNAPUNCH', p_photo_name);
    -- insert a NULL record to lock
    INSERT INTO photos (imageid, image_name, image)
    VALUES (p_id , p_photo_name, EMPTY_BLOB())
    RETURNING image INTO dst_file;
    -- lock record
    SELECT image
    INTO dst_file
    FROM photos
    WHERE imageid = p_id AND image_name = p_photo_name
    FOR UPDATE;
    -- open the file
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    -- determine length
    lgh_file := dbms_lob.getlength(src_file);
    -- read the file
    dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
    -- update the blob field
    UPDATE photos
    SET image = dst_file
    WHERE imageid = p_id
    AND image_name = p_photo_name;
    -- close file
    dbms_lob.fileclose(src_file);
    END load_file;
    display image
    PROCEDURE display_image(p_id NUMBER) IS
    Photo BLOB;
    v_amt NUMBER DEFAULT 4096;
    v_off NUMBER DEFAULT 1;
    v_raw RAW(4096);
    BEGIN
    -- Get the blob image
    SELECT image
    INTO Photo
    FROM PHOTOS
    WHERE IMAGEID = p_id;
    owa_util.mime_header('images/jpg');
    BEGIN
    LOOP
    -- Read the BLOB
    dbms_lob.READ(Photo, v_amt, v_off, v_raw);
    -- Display image
    htp.prn(utl_raw.cast_to_varchar2(v_raw));
    v_off := v_off + v_amt;
    v_amt := 4096;
    END LOOP;
    dbms_lob.CLOSE(Photo);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END;
    END;
    The url I enter is: http://webdev:7777/tisinfo/tis.tiss0011.Display_Image?p_id=1

    Just a little more information. When I enter owa_util.mime_header('image/jpeg') I can't display the file. It just shows up with a red x for the file.
    When I enter owa_util.mime_header('image/jpg') it displays the file, but in the format
    ¿¿¿¿JFIF¿¿-Intel(R) JPEG Library, version [2.0.16.48]¿¿C
    This is the way I would expect it to look if I opened it with Notepad, or an application that doesn't recognize jpg files. Can anyone tell me what I am doing wrong?? Thanks.

  • PHP - Load Gif image into Oracle Blob field - ORA-00972 error

    I am receiving an " ORA-00972 - Identifier Is too Long" error message when I try to update a BLOB field with file contents from a gif file.
    __GIF FILES_:_
    c:\bl\x_PageLayout-4_LA.gif (15K)
    c:\bl\x_PageLayout-4_Spec.gif (21k)
    ===================================================================================================================================
    ORACLE DATABASE (STYLEELEMENTPIX TABLE):*
    STYLE_ID NUMBER
    SEQ_KEY NUMBER
    PIX_NAME VARCHAR2(30 BYTE)
    PIX BLOB
    PIX_LABEL VARCHAR2(30 BYTE)
    MODIFY_DATE DATE
    PIX_TYPE CHAR(1 BYTE)
    DEFAULTDISPLAY CHAR(1 BYTE)
    PIX field currently is null
    ===================================================================================================================================
    PHP CODE:*
    $filename = 'C:\BL\\';
    $filename .= $row->PIX_NAME; //filename of gif ex: c:\bl\x_PageLayout-4_LA.gif
    $fp = fopen($filename, "rb"); //open gif file
    $file_content = fread($fp, filesize($filename)); //read gif file
    //set gif file in PIX field (PIX datatyle BLOB)
    $cursor1 = oci_parse($conn, "UPDATE STYLEELEMENTPIX SET PIX = '$file_content' WHERE STYLE_ID = $row->STYLE_ID AND SEQ_KEY = $row->SEQ_KEY");
    oci_execute ($cursor1);
    For both records, style id will be 100 ($row->STYLE_ID), and seq_key will be 1 for the first record and 2 for the second ($row->SEQ_KEY)
    ===================================================================================================================================
    ERROR MESSAGE:
    Warning: oci_parse() [function.oci-parse]: ORA-00972: identifier is too long in C:\wamp\www\eStyleGuide\Admin\BLOB.php on line 44 ($cursor1 = ....)

    Use a LOB locator. See "Inserting and Updating LOBs" on p 193 of the free book http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
    A more concerning issue is the security implications of using string concatenation to construct the SQL statement. It is recommended to use bind variables.

  • Access BLOB field in Oracle database

    Dear Sir,
    I am using Pro* C to access oracle blob fields
    I write "12345" to Oracle Blob field, when I read it it is fine.
    I then modify this record to "ABC", when I read it, I get "ABC45",
    How can I set blob field to the initial state to modify BLOB field correctly ?
    Many Thanks
    Liang

    Initially you write 12345 and when you modify you are modiyfing only 3 bytes from offset 1 and hence the results. When you modify oracle will not erase the complete lob you need to use erase before you modify (write)
    Following doc give you an insight into pl/sql lob functions
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lob.htm#sthref4428
    Following is the Pro*C Lobs Guide
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28427/pc_16lob.htm#i998068

  • Insert/update image in Database from C:\ drive, In BLOB Field using PL/SQL

    is Any Body have a experience of Image file Saving, updating and getting from Table, i want to save it in Database not in any Folder or Link, its Urgent! i want to insert image in Table having BLOB field from C:\test.jpg

    Try the following link, some useful material :-
    http://www-rohan.sdsu.edu/doc/oracle/server803/A50580_2/img_uses.htm

  • "People Picker" field not letting update SP linked table in Access

    Hello all,
    I have linked a SharePoint list to an Access database in order to manipulate some data. This list contains several fields, including a people picker in which its data come from SharePoint. 
    Once in my Access DB, I need to update some fields of this list, however when I try to change some values from a record that has the people picker populated I get the following error message: "you cannot reference rows created
    when you are disconnected from the server because this violates the lookup settings defined for this table". I only get this when I have values on people picker, I can proceed without any problem when I have it set as blank.
    So, do you have any idea on how to accomplish an update operation while having a people picker field populated?
    Thank you in advance.

    Hi Pedro,
    I recommend to check if the user populated in the RequestBy exits in User Information List in SharePoint site and the choices listed in Access for status field are existed in SharePoint Status column.
    Please refer to this thread for more details:
    https://social.technet.microsoft.com/Forums/office/en-US/8a7baf3b-5a3a-4631-82f9-b43d992155d1/updating-sharepoint-2010-list-from-access-2007?forum=sharepointgenerallegacy
    More reference:
    http://blog.incworx.com/blog/elizabeth-pecoras-sharepoint-blog/you-cannot-update-this-field-because-the-value-youre-trying-to-apply-is-not-valid-or-would-break-a-data-integrity-rule-error
    Best regards.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Want to update BLOB field to LONG field.

    We have 2 table one were BLOB field is there, another were LONG i want to transfer BLOB to LONG fields. Please advice how i can?
    I tried DBMS_LOB and UTL_RAW.CASTE_TO_VARCHAR2 its working but its saving some initials unwanted character.
    Thanks
    Bakulesh

    As I understand, 1 BLOB does have BINARY data. And, you have to copy that to LONG RAW and not just LONG. The unwanted cahracters are those BINARY data. ( They might be really of some use ! )
    We have 2 table one were BLOB field is there, another were LONG i want to transfer BLOB to LONG fields. Please advice how i can?
    I tried DBMS_LOB and UTL_RAW.CASTE_TO_VARCHAR2 its working but its saving some initials unwanted character.
    Thanks
    Bakulesh

  • Problem inserting a gif into a blob field in a table with sqldev / forms6i

    Problem solved - For those that might be interested, the errors don't make much sense - the problem was with the gif. Seems that these 28 gifs plus the new scans were saved from the scanner with
    GIF - LZW, Transparent color: 255
    Converting them to Black and white allowed them to be loaded.
    If anyone understands why, I'd like to know
    glenn
    I was previously having a problem deleting a row with a blob and it was suggested that I create the table using rowdependencies - which I did as follows.
    CREATE TABLE "MDD"."MDD_FIGURE2"
    (     "FG_FIGURENAME" VARCHAR2(18 BYTE),
         "FG_FIGURE" BLOB,
         CONSTRAINT "FG_FIGURENAME_NN" CHECK ("FG_FIGURENAME" IS NOT NULL) ENABLE
    ) ROWDEPENDENCIES;
    Then I copied my data from my previous table with the following - and everything came across
    INSERT INTO MDD_FIGURE2 (fg_figurename, fg_figure)
    SELECT FIG_FIGNAME, FIG_FIGURE FROM MDD_FIGURE;
    mdd_figure2 was then renamed to mdd_figure
    The table, Mdd_Figure, already contains some 2000+ .gifs that were successfully loaded with Forms 6i (yes, I know it is old, but I am stuck with having to use it). All the .gifs I am loading are from scans and all are less than 64k. However, 28 .gifs would not load. When I insert the .gif into the field and committed the form, the status message tells me a record was written but when I check it, the blob is empty.
    So, when I try to insert one of these problem .gifs in SqlDeveloper, I open the new mdd_figure table, select the blob field, open the edit dialog, set it to figure, select the .gif that I want to load and then save it. The blob field changes from NULL to BLOB, but it is empty. When I try to commit, I get the following error from SqlDev.
    UPDATE "MDD"."MDD_FIGURE" SET WHERE ROWID = 'AAAOeWAAEAAABAlAAz' AND ORA_ROWSCN = '358136842'
    One error saving changes to table "MDD"."MDD_FIGURE":
    Row 14: ORA-01410: invalid ROWID
    I use rollback to restore the record to it's previous state.
    If I load one of the successfully loaded .gifs into the same field, it loads perfectly as follows.
    UPDATE "MDD"."MDD_FIGURE" SET WHERE ROWID = 'AAAOeWAAEAAABAoAAp' AND ORA_ROWSCN = '358136522'
    Commit Successful
    It appears the 28 gifs have a problem. I've re-scanned them, with the same results. They are just small scanned line map images from our earlier publications. They view properly in several different graphics programs and I can't find anything wrong with them.
    I notice that the ROWID's are different while the ORA_ROWSCN's are the same - but what is the significance of that?
    Any suggestions as to what is happening and what I can do about it?
    Thanks for any help you can give me.
    glenn
    (Database is 10R2 and sqldev is the most recent one)
    Edited by: gconley on Sep 25, 2008 9:51 PM

    solved it myself - problem was with the gif

  • Problem w/ image item using 9i BLOB field and InterMedia ORDImage Object

    Hi,dear all,
    I have a problem with image item in Form 6i. Oracle 9i is used as backend DB, and a table contains image data is created for testing:
    create table image_test(
    id number,
    image blob
    In Form 6i, there is no problem to create a block for inserting/updating the image record into the database. However, it can not be used to retrieve image (blob field), the image item remains empty after 'execute query', while the id field can be retrieved. When the same table is created in Oracle 8.1.7, and the exact same form can be used without any problem both in inserting and retrieval. It seems that the Oracle 9i does not use the same way to store BLOB column. Has anybody ever encountered this problem? How to retrieve image (BLOB) in Form 6i from Oracle 9i?
    I tried to use interMedia ORDImage as the data type in Oracle 9i, that is,
    create table image_test(
    id number,
    image ORDSYS.ORDImage
    Same problem, the form can insert record with image, but when retrieving, nothing displayed. Anybody could help! Thanks in advance!

    hi!
    well working with oracle8i and form6i.
    same problem..but i used (instead of blob or clob as datatype..) Long raw..
    it can be saved as usual..i mean Commit..
    and can be retrieved..using Execute_Query..its working fine..
    well if anybody get any other solution..do inform..
    mail_id:
    [email protected]

Maybe you are looking for

  • ABAP OO Code in routines

    Hi,      Is BI 7.0 supports normal ABAP code and OO ABAP Code?   r we need to write only OO ABAP code in routines

  • Error -50 when opening a m4v file

    Hi, I have trouble opening m4v files with quicktime. I get a message box stating: Error -50: an unknown error occurred This happens on some PCs only. Re-installing quicktime doesn't help. If I change the extension to .mov, the files are playing fine.

  • BUG - Printing data models just shows empty boxes

    Hi, I am running JDeveloper 10.1.3.2.0.4066. When i try and print, the entity boxes are empty and so cannot see the fields/constraints. This is quite critical!!! Cheers R

  • OTL Timecard Restrict Expendituretype LOV

    Hi, I'm really stuck with following issue. My client has the requirement to restrict the Expendituretype LOV based on selected project. I know this is possible and read all documentation about it but I can't get it working. It should be possible beca

  • My payment in Clash of Clans was cancelled on Iphone 5S, but on iPhone 5 all in normal///

    My payment in Clash of Clans was cancelled on Iphone 5S, but on iPhone 5 all in normal. Sistem messege "Purchase failed! Не удается подключиться к iTunes Store