Should I be able to update a Blob via a ResultSet? (11g driver exception)

This code fails at the last line:
stmt = conn.createStatement();
String tableName = "TBL_esun01_PPP";
stmt.execute("drop table TBL_esun01_PPP");
stmt.execute("create table TBL_esun01_PPP (sid int not null primary key, blob_col blob)");
stmt.close();
//insert test data
String blobContent = "WLS JDBC4 test for blob.";
String blobContentUpdate = "WLS JDBC4 test for UpdateBlob. [Updated]";
ByteArrayInputStream inputStream = new ByteArrayInputStream(blobContent.getBytes());
ByteArrayInputStream inputStreamUpdate = new ByteArrayInputStream(blobContentUpdate.getByte
s());
String insertSql = "INSERT INTO " + tableName + " VALUES (?, ?)";
PreparedStatement pstmt = conn.prepareStatement(insertSql);
int key = 1;
pstmt.setInt(1, key);
pstmt.setBlob(2, inputStream);
pstmt.execute();
pstmt.close();
inputStream.close();
//update data
String querySql1 = "SELECT sid FROM " + tableName;
String querySql2 = "SELECT sid, blob_col FROM " + tableName;
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
// we can get updatable resultset in the same way without lob object.
// following updating can succeed.
System.out.println("Get updatable resultset using: "+querySql1);
ResultSet rs = stmt.executeQuery(querySql1);
rs.next();
rs.updateInt(1, 2);
rs.updateRow();
rs.close();
inputStreamUpdate.close();
System.out.println("Get updatable resultset using: "+querySql2);
try {// failed to get updatable resultset
rs = stmt.executeQuery(querySql2);
rs.next();
rs.updateBlob(2, inputStreamUpdate); // Fails here...
The driver is 11.1.0.6.0-Production
The DBMS is Oracle Database 11g Release 11.1.0.0.0 - Production
Get updatable resultset using: SELECT sid FROM TBL_esun01_PPP
Get updatable resultset using: SELECT sid, blob_col FROM TBL_esun01_PPP
We can not get updatable Resultset. Exception message:
java.sql.SQLException: Invalid operation for read only resultset: updateBlob
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.BaseResultSet.updateBlob(BaseResultSet.java:506)
at TestUpdatableRS.test(TestUpdatableRS.java:84)
at TestUpdatableRS.main(TestUpdatableRS.java:112)
thanks,
Joe

Joe,
a) I could not find updateBlob(int, java.io.InputStream). It is updateBlob(int, java.sql.Blob).
b) I tried the below test and it worked fine, I am using the latest drivers.
CREATE TABLE BLOB_TABLE (C1 NUMBER, C2 BLOB);
INSERT INTO BLOB_TABLE VALUES(55, '101011');
public static void test2(Connection conn) throws SQLException {
System.out.println("test -");
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
String query = "select c1, c2 FROM blob_table";
pstmt = conn.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
rs = pstmt.executeQuery();
SQLWarning x = pstmt.getWarnings();
if (x != null)
System.out.println(x.getMessage());
x = rs.getWarnings();
if (x != null)
System.out.println(x.getMessage());
BLOB blob = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
byte[] b = new byte[50];
java.util.Arrays.fill(b, (byte) 53);
blob.putBytes(1L, b);
if (rs.next()) {
rs.updateInt(1, 88);
rs.updateBlob(2, blob);
rs.updateRow();
x = rs.getWarnings();
if (x != null) {
System.out.println(x.getMessage());
} catch (SQLException ea) {
System.out.println(ea);
} finally {
if (rs != null) {
rs.close();
if (pstmt != null) {
pstmt.close();
System.out.println("test - done");
} // end of test2(Connection);
==
Ashok

Similar Messages

  • Should I be able to access virtual host via localhost/site path?

    I finally have been able to successfully set up a virtual host on my local host.
    I can access http://localhost which redirects me to the http://localhost/xampp page and I can access my local site with http://nif.local/. I thought I had read that I should still be able to access my local nif site via http://localhost/nif.local. Is that correct? If so, what should I check since I get a 404 error via the second way? I just want to make sure everything is set up correctly.
    Thank you.

    Now sorted;-).  Can disable Siri in settings for when phone is locked. Why is this not default?

  • About update a blob via JDBC

    I want to update a blob value via jdbc.
    The following is my program(part)
    1)String sqlstr = "SELECT * FROM test WHERE vchar='anyone' ";
    2)ResultSet rset = stmt.executeQuery(sqlstr);
    3)BLOB blob = ((OracleResultSet)rset).getBLOB(2);
    4)OutputStream outstream = blob.getBinaryOutputStream();
    when excute the line
    #5)outstream.write(...);
    A IOException throwed. And said "row containing the LOB value is not locked"
    So I change the sqlstr value as
    sqlstr = "SELECT * FROM test WHERE vchar='B' FOR UPDATE";
    Then ,when I restart the programe,it stoped at the line 2) and nothing tell me.
    Just one thing I can do is ctrl-c to corrupt
    it.
    Can you tell me how to resolve it.
    thank you.
    null

    Please take a look at this: http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/sample_code_index.htm
    You must do
    select ... for update;
    even before you manipulate LOB's.

  • Have an hp compaq dx 2200 with a D drive, should I be able to copy photos onto a CD with this drive?

    can anyone answer this question?

    to scfliers: yes its possible to copy photos with this drive because chances are that you have an app that can handle it
    all you have to do is get acquanited with its capabilities
    good luck
    hpe this helps you
                                                                                                                 spacechild

  • I'm trying to update iOS 7 and it says I need 3.4 GB of storage to update.. I currently have on my storage 797 MB and 12,6 GB used. How much storage should it write for me to be able to update?

    I'm trying to update iOS 7 and it says I need 3.4 GB of storage to update.. I currently have on my storage 797 MB and 12,6 GB used. How much storage should it write for me to be able to update?

    If your ipad has only 797 MB free and it tells you that you need 3.4 GB to update, then you need to begin deleing files, whatever it takes to free up space.
    Consider...
    Delete apps you don't use.
    Delete videos you don't want (these take up a lot of space).
    Do you have a lot of emails stored on the device?
    Are there apps that store data files, like a PDF reader?  If there are a lot of these, you need to delete some.
    The bottom line is that you need to remove data and/or apps on your device to make more storage available.
    But for videos and photos, always sync them to a computer first to archive them.

  • Upgrading to 10.1.3.1 - should I be able to using 'check for updates'

    I'm using JDev 10.1.3.04; from Help | Check for Updates menu I checked to see if I could upgrade to 10.1.3.1 but it did not provide this option? Should I be able to upgrade this way? If not how?
    Also, secondary question to confirm - will I need to re-install the Tomcat ADF Runtime components? anything else?
    thanks

    Hi,
    check for upgrades is used for Service Updates (SU) only. JDeveloper 10.1.3.1 is a new JDeveloper release that also includes upgrades applied to the runtime
    Frank

  • While i was updating my iphone5, it showed that my sim card is not applicable. even after changing the sim card, i am not able to update or restore my iphone. what should be done?

    while i was updating my iphone5, it showed that my sim card is not applicable. even after changing the sim card, i am not able to update or restore my iphone. what should be done?

    Hi there aliyan,
    I would recommend taking a look at the troubleshooting steps for "No SIM" found in the article below. 
    If you see 'No SIM' alert on iPhone
    -Griff W.

  • Hello everybody, I need to update my ITunes on my MAC (laptop) to the newer version so I can then be able to update the latest updates for my Iphone-3G'S. I don't require a complete reinstall just need to be able to update it.What I have tried so far is I

    Hello everybody, Im trying to update my ITunes on my MAC (laptop) to the newer version so I can then be able to update the latest updates for my Iphone-3G. I don’t require a complete reinstall just need to be able to update my itunes.
    What I have tried so far is I had my MAC search for update’s and it said that I should update to (ITunes version  10 . 6 . 3 ) So I asked it to do the update but after 2hrs of waiting for it to download/update it then puts up a message saying the following- (In order to continue installation, please close the following application: ITunes).
    When I tried to do this another message comes up that says- (The update ITunes can’t be installed. The following install step failed: run preupgrade script for Apple mobile device support. Contact the software manufacturer for assistance.)
    I have also tried to run the update while having closed ITunes before I even start the update but the same problem happens after waiting about 2hrs.
    Some one that had the same problem said this might be happening in the older operating systems. But that does not make sense because surely Apple want customers who own a MAC and i-phone to still buy from iTunes.
    My MAC is about 4-5years old. I have a i-phone.3G, 
    Can anybody help me please and Thank you?

    Download iTunes using the tab at the top of this page. Then run the update with iTunes closed.

  • How do i delete an old iCloud account from phone when I forget my password and I'm not able to reset it because my security questions do not match?! Help!! Currently not able to update any apps or icloud info

    How do i delete an old iCloud account from phone when I forget my password and I'm not able to reset it because my security questions do not match?! Help!! Currently not able to update any apps or icloud info...

    If your device is signed into an old ID of yours that is an earlier version of the ID you want to sign in with, do the following:
    If you are using iMessage and FaceTime, make sure you are signed into these services with your current ID.  If they are signed into the old ID, go to Settings>Messages>Send & Receive and Settings>FaceTime, tap the ID, sign out, then sign back in with your current ID.
    Then temporarily recreate the old ID by going to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  (You should not have to verify the old email account so it doesn’t matter if you no longer have access to it.)  Now go to Settings>iCloud, turn off Find My iDevice and enter your current password when prompted (even though it prompts you for the password for your old ID).  Then save any photo stream photos that you wish to keep to your camera roll (unless you are using iCloud Photo Library).  When finished go to Settings>iCloud, tap Sign Out (or Delete Account if you are not running iOS 8) and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address back to the way it was.  Now you can go to Settings>iCloud and sign back in with your current iCloud ID and password (your data will download back to your device).

  • Major heat problem. should i be able to hear the fans?

    my black macbook with 1gb ram is getting very hot when i use front row to play videos at full screen. after about 30-40 mins the left corner of the macbook is so hot i can only touch it for a second or so. then without warning the video just freezes. the picture remains on the screen but looks like it's paused. i then get the spinning colour wheel. the only way to rectify is to force a power off (force quit has no effect). i have to let it cool down for a while and try again. it works fine after that until it gets hot again.
    when it locks up, it is completely silent. should i be able to hear the fans working? there is no warm air being expelled from any part of the unit as far as i can tell. the case is just really hot.
    i ran a little experiment by pointing a desk fan at the notebook and it played fine for five hours without problems!!! the corner of the macbook was cool to the touch.
    this happens in lid closed or open modes.
    anyone else have this or is it time to call applecare?
    Macbook Black 1gb Ram 120gb HDD   Mac OS X (10.4.7)  
    Macbook Black 1gb Ram 120gb HDD   Mac OS X (10.4.7)  

    UPDATE
    ok, so we have had the firmware update and guess what?
    all seems ok now!!!!
    coreduotemp now reports 65 degrees after playing video at full screen. much better than the 85 degrees it was hitting. now when it gets hot i can hear the fans going. i ran a terminal window and did yes > /dev/null and after only a few seconds the temp was rising to 85-87 and the fans came on really hard and brought it to 68-70. no system stall yet.
    normal idle while using only safari over airport is between 41-45 degrees!!!!
    i am very happy so far. lets just hope it is the cure.
    many thanks for reading and replying.
    Martin.

  • I have a Macbook Model No A1181 2.4 GHz intel core 2 Duo with 4 Gb Ram. Should I be able to instal Final Cut Pro 3.0.2 cos I'm having problems?

    I have a Macbook Model No A1181 2.4 GHz intel core 2 Duo with 4 Gb Ram. Should I be able to instal Final Cut Pro 3.0.2 cos I'm having problems? As I read it My machine should be able to run the software.
    Thanks in advance

    You are trying to use software that is over 10 years old. As I read it, FCP 3.0.2 required 10.1 or higher at the time, but as FCP is reliant on quicktime, which has been updated many, many times, I doubt that you will ever get it to work properly.

  • Should I be able to use MobileMe features if I have an iCloud account?

    I recently purchased an iCloud account. 
    Should I be able to post a webpage using iWeb with iCLoud?
    When trying to publish the page i'm asked to sign in to mobileme.  I thought maybe icloud would be sufficient.

    MobileMe closed over a year ago, and iCloud does not provide website hosting services. iWeb has not been updated for several years and is no longer sold or supported, so it still offers the non-functional MobileMe option.
    Up to and including iWeb '08, it was only possible to publish to other hosts by 'Publishing to a folder' and then uploading that local folder to a website host using a separate FTP client. From iWeb '09 an FTP method was built-in, making it easier to publish to a host other than MobileMe.
    In order to upload your existing site in iWeb '09 and above:
    Click on the name of the site in the sidebar: the publishing settings pane will open. Set 'Publish to' to 'FTP'. Enter the name of the site and a contact address (if desired).
    In the 'FTP Server Settings' section you will need to know the server address (your hosting service can tell you that), and your username and password for that service. Your site will be published in a folder with its name at root level of the server, with an index.html file at root level (which will overwrite any index.html file which may be there already). The 'Directory/Path' field may need to include a path such as '/webspace/' or 'ht_docs/' - this is dependent on your hosting service and they should tell you this. If you want to publish within a folder you can add that to the path.
    You can then click the 'Test connection' button so that iWeb can check that it can get access to your server space. You should enter the URL of the site in the 'URL' field so that rss feeds and internal links have the correct address.
    To publish using an earlier version of iWeb:
    From the File menu choose 'Publish to a folder'. You should create a folder somewhere convenient specifically for this and choose it when publishing to a folder: this folder should not contain anything else.
    You now need an FTP program (FTP is the 'protocol' used for uploading) to upload the contents of the folder to your server.Cyberduck is free (donation requested): Transmit is $34 but I think better. You will need the server address (your hosting service can tell you that), and your username and password for that service. You can drag the contents of your folder to your webspace, or create a folder there and drag the contents to that if you prefer.

  • How can I update my Mac OS X v 10.4 Tiger as because it is out of date I am not able to update Safari or Mozilla and am concerned about security

    How can I update my Mac OS X v 10.4 Tiger as apple have no more updates and yet I am no longer able to update my Safari or Mozilla applications please advise me.

    Crocosmia wrote:
    Thank you for advise, will try apple store  another thing how can I increase my ramm and memory
    Check your machine's actual specifications here.
    It looks like you can support up to 3 MByte in a 17" iMac and up to 4 Mbyte in a 20" iMac, if your cache size coordinates with the specs on the linked page.
    OWC says you should be able to put 4 Gbyte into your machine here.  Wherever you get the memory, it would be a good addition.  This is the Apple Store listing for your machine, as near as I can figure it.

  • Not able to update more than 10,000 records in CT04 for a characteristic

    Hi all,
    We are not able to update more than 10,000 records in CT04 for a certain characteristic.
    Is there any possible way to do this?
    Please advise...its a production issue.
    Thanks.

    Hello ,
    Please consider using a check table for the characteristic involved if you are working with large
    number of values assigned
    With a check table you have a possibility to work with a huge amount of values , also the performance should improve                          
    Please refer to the link
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/ec/62ae27416a11d1896d0000e8322d00/frameset.htm
    Section - Entering a Check Table 
    Hopefully the information helps
    Thanks
    Enda.

  • I am not able to update my i pad

    I am not able to update my i pad

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 7.0.4. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    You can no longer update to iOS 6.x, or down grade the iOS.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.htmlhttp://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and antivirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
    Tip 2 - If you're updating via wifi, place your iPad close to your router to preclude getting a corrupted download.
    How to Upgrade to iOS 7
    The iOS 7.0 update requires around 2.5 GB of storage space, so if your iPad is almost full, you may need to clear up some space. You can check your available space in Settings -> General -> Usage.
    There are two ways to upgrade to iOS 7: You can use your Wi-Fi connection, or you can connect your iPad to your PC and update through iTunes. We'll go over each method.
    To upgrade using Wi-Fi:
    Note: If your iPad's battery is under 50%, you will want to plug it into your charger while performing the update.
    Go into the iPad's Settings.
    Locate and tap "General" from the menu on the left.
    The second option from the top is "Software Update". Tap this to move into the update settings.
    Tap "Download and Install". This will start the upgrade, which will take several minutes and will reboot your iPad during the process. If the Download and Install button is grayed out, trying clearing up some space. The space required by the update is mostly temporary, so you should gain most of it back after iOS 7 is installed.
    Once the update is installed, you may have to run through the initial steps of setting up your iPad again. This is to account for new features and settings.
    To upgrade using iTunes:
    First, connect your iPad to your PC or Mac using the cable provided when you purchased your device. This will allow iTunes to communicate with your iPad.
    You will also need the latest version of iTunes. Don't worry, you will be prompted to download the latest version when you launch iTunes. Once it installs, you may be asked to setup iCloud by logging into your iTunes account. If you have a Mac, you may be prompted on whether or not you want to enable the Find my Mac feature.
    Now you are ready to begin the process:
    If you upgraded iTunes earlier, go ahead and launch it. (For many, it will launch automatically when you plug in your iPad.)
    Once iTunes is launched, it should automatically detect that a new version of the operating system exists and prompt you to upgrade to it. Choose Cancel. Before updating, you will want to manually sync your iPad to make sure everything is up to date.
    After canceling the dialog box, iTunes should automatically sync with your iPad.
    If iTunes doesn't automatically sync, you can manually do it by selecting your iPad within iTunes, clicking on the File menu and choosing Sync iPad from the list.
    After your iPad has been synced to iTunes, select your iPad within iTunes. You can find it on the left side menu under Devices.
    From the iPad screen, click on the Update button.
    After verifying that you want to update your iPad, the process will begin. It takes a few minutes to update the operating system during which time your iPad may reboot a few times.
    After updating, you may be asked a few questions when your device finally boots back up. This is to account for new settings and features.
     Cheers, Tom

Maybe you are looking for