How to use insert row with BLOB to Oracle when use connection pool?

Hi, All,
I am writing a program to store files (mapped to be a column with BLOB datatype
in the table) to Oracle database.
But I always get java.lang.ClassCastException:weblogic.jdbc.rmi.SerialBlob
Here is my code, please help. Thanks a lot!!
String sqlNewRow = "insert into documents (id, companyid, updatedate, description,
document, addby, title) ";
sqlNewRow += "values (?, ?, TO_DATE(?, 'MM/DD/YY'), ?, EMPTY_BLOB(), ?,
con.setAutoCommit(false);
ps = con.prepareStatement(sqlNewRow);
ps.setInt(1, documentid);
ps.setInt(2, companyid);
ps.setString(3, updatedate);
ps.setString(4, description);
ps.setString(5, username);
ps.setString(6, filename);
ps.executeUpdate();
ps.close();
String sqlLockRow = "select document from documents where id = ? for update";
java.sql.PreparedStatement pst = con.prepareStatement(sqlLockRow);
pst.setInt(1, documentid);
java.sql.ResultSet rset = pst.executeQuery();
rset.next();
java.sql.Blob dbBlob = rset.getBlob(1);
out.println("it's=" + dbBlob.getClass());
OutputStream dbBlobOut = ((weblogic.jdbc.vendor.oracle.OracleThinBlob)dbBlob).getBinaryOutputStream();
dbBlobOut.write(oneString.getBytes());
dbBlobOut.close();
rset.close();
pst.close();

Have you defined
OutputStream dbBlobOut
as weblogic.jdbc.vendor.oralce.OracleThinBlob?
Mitesh
Almond wrote:
Hi, All,
I am writing a program to store files (mapped to be a column with BLOB datatype
in the table) to Oracle database.
But I always get java.lang.ClassCastException:weblogic.jdbc.rmi.SerialBlob
Here is my code, please help. Thanks a lot!!
String sqlNewRow = "insert into documents (id, companyid, updatedate, description,
document, addby, title) ";
sqlNewRow += "values (?, ?, TO_DATE(?, 'MM/DD/YY'), ?, EMPTY_BLOB(), ?,
con.setAutoCommit(false);
ps = con.prepareStatement(sqlNewRow);
ps.setInt(1, documentid);
ps.setInt(2, companyid);
ps.setString(3, updatedate);
ps.setString(4, description);
ps.setString(5, username);
ps.setString(6, filename);
ps.executeUpdate();
ps.close();
String sqlLockRow = "select document from documents where id = ? for update";
java.sql.PreparedStatement pst = con.prepareStatement(sqlLockRow);
pst.setInt(1, documentid);
java.sql.ResultSet rset = pst.executeQuery();
rset.next();
java.sql.Blob dbBlob = rset.getBlob(1);
out.println("it's=" + dbBlob.getClass());
OutputStream dbBlobOut = ((weblogic.jdbc.vendor.oracle.OracleThinBlob)dbBlob).getBinaryOutputStream();
dbBlobOut.write(oneString.getBytes());
dbBlobOut.close();
rset.close();
pst.close();

Similar Messages

  • Hi i want to know how i can use my ipod with my itunes because when i connect it it odesnt apper there it just says it cannot be used because apple mobile device is not started

    ipod wont apper in itunes say apple mobile device not started

    Go here for corrective action.
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

  • Is it possible to insert row with timestamp field without to TO_TIMESTAMP

    hello
    is it possible to insert row with timestamp column without using to_timestamp unction
    somthing like insert into app.master values (3,333, 'inser tmstmp', 6.7, '2010-11-10 15:14', 'f','9','2010-12-22')

    784633 wrote:
    hello
    is it possible to insert row with timestamp column without using to_timestamp unction
    somthing like insert into app.master values (3,333, 'inser tmstmp', 6.7, '2010-11-10 15:14', 'f','9','2010-12-22')If you don't like the answers in your previous thread (Re: how can i set timestamp format don't expect to get different answers just because you start a new thread.

  • How do I activate a used iPhone 3 with no SIM card for use as an ipod touch?

    How do I activate a used iPhone 3G with no SIM card for use like an iPod Touch? It was apparently on AT&T previously and I have another iPhone 3 that is active on AT&T if that is helpful. Thanks!

    Copied from the link provided.
    Follow these steps to use your iPhone without a wireless service plan:
    Insert the SIM card from your new, activated iPhone or one that was previously used to activate the original iPhone.
    Connect the iPhone to iTunes on a computer connected to the Internet.
    Once iTunes activates the device, you're free to use the iPhone as if it were an iPod touch.

  • Transient VO insert error-Attempting to insert row with no matching EO base

    Hi ,
    I have a transient Vo (created using option - rows populated programmatically, not based on Query) and I need to uptade/insert rows in vo on click of a button.
    when i nsert row, i get following error
    oracle.jbo.InvalidOperException: JBO-26020: Attempting to insert row with no matching EO base
    This is what I am doing in my code
    ViewObject vo2 = am.findViewObject("TransientVO1");
    vo2.executeQuery();
    if (vo2 == null) {System.out.println("vo2 is null");}
    if (vo2 != null)
    System.out.println("in vo2 != null");
    Row row2 = vo2.createRow();
    row2.setAttribute("PlatformName", "ss");
    row2.setAttribute("UserName", "ss");
    vo.insertRow(row2);
    System.out.println(" vo2.getRowCount()"+ vo2.getRowCount());
    Why is it saying no EO base... is it mandatory to have EO for transient VO? Please help.
    Thanks

    The EO handles all DML, hence you need it if you have to set attributes in a VO. An EO handles the storage of a the single row (or part if your VO consists of multiple tables).
    You can try and overwrite the setter method of the attributes in ViewRowImpl class and store the changes somewhere else.
    Timo

  • Can LogMiner capture DMLs against rows with Blob datatype?

    Hi,
    Can LogMiner catch DMLs against rows with Blob datatype?
    if a Blob column is 4G big each row, and you delete millions of
    rows, but your redo log files is only 600M totally, I don't know (not sure) how those before-images of data can be stored in redo logfiles (also, you may need a very large log_archive_dest to hold those before-images )
    please help to explain.
    Thanks
    Roy

    Hi,
    Can LogMiner catch DMLs against rows with Blob datatype?
    if a Blob column is 4G big each row, and you delete millions of
    rows, but your redo log files is only 600M totally, I don't know (not sure) how those before-images of data can be stored in redo logfiles (also, you may need a very large log_archive_dest to hold those before-images )
    please help to explain.
    Thanks
    Roy

  • JBO-26020: Attempting to insert row with no matching EO base

    Hi All,
    I have a bit of a problem here. The following is some background information. Please help if possible.
    Aim: I have a custom application whereby I need to add the sequence value (assuming the sequence.nextval is already taken and stored into a variable/original table) to my custom table.
    Procedures taken: I have found the EO which gets the sequence value for the original application and the VO that gets the EO. I have added both EO and VO to my project and tried to add the VO to my custom AM. In my custom AM I have added the following code to initialize the create function of the standard EO:
    **********CODE******************
    OAViewObject vo3 = (OAViewObject)getRegRequestsVO1();
    if (!vo3.isPreparedForExecution())
    vo3.executeQuery();
    Row row = vo.createRow();
    vo3.insertRow(row);
    row3.setNewRowState(Row.STATUS_INITIALIZED);
    Problem: However when I use the code vo3.insertRow(row); it prompts me with the applicaiton error of JBO-26020: Attempting to insert row with no matching EO base. I don't quite understand what I am doing wrong.
    Can anyone please help.
    Cheers

    This i have find out .
    FYI...
    JBO-26020: InvalidOperException
    Cause: The application code tried to take a row from one row set (or view object) and insert it into another row set (view object). In response, the framework will make a "copy" of the row in the new row set. This new row will share references to the underlying entity objects. However, if the source and destination row sets do not share any entity object bases at all, this operation will fail as it does not find any entity rows to share.
    Action: When attempting to take a row from one row set and insert into another, make sure that they share at least one entity object base.
    Thanks

  • How do you insert an image into a google map using a macbook?

    I am trying to put images into a Google map using my MacBook, but cannot seem to find any help. How do I insert an image into my Google map using my MacBook?

    Nothing complicated with your menu - very clear "ADD Image" but my menus are not as simple. Everytime I need to add an image I spend 5-10 minutes searching again. Wonder why so hard. I generally find Acrobat menus cryptic and unclear and I am big Adobe fan - use Illustrator, Photoshop, Dreamweaver, Premier, Fireworks etc - but Acrobat menus are like calculus in the dark.

  • Can I use Front Row with my Macbook closed?

    I just got a mini-dvi to video cable for my macbook. I love using front row with it but I was wondering if there was a way that you could use front row with the laptop closed. Oh and I'm using tiger, so its not the new version of front row.

    With your computer attached to a keyboard you should be able to wake it from sleep and run it properly with the lid closed.

  • How do you stop needing to verify email password when using yahoo.att with Mac Mail

    How do you stop needing to verify email password when using yahoo.att with Mac Mail?

    Nevermind, I fixed it (I think).  I went into Settings | Accounts & Sync and found Yahoo at the bottom of the list (alphabetically).  I selected it and it had an optiion to delete the account, which I did.

  • How can I share photos with others in other places using ICloud?, How can I share photos with others in other places using ICloud?

    How can I share photos with others in other places using ICloud?

    If you have iPhoto on an iOS device rather than a Mac, you can create a 'Photo Journal', which is an online gallery hosted on iCloud: details here -
    http://help.apple.com/iphoto/ipad/1.0/#blnkaf3ef70a
    This facility is not as yet available in iPhoto on a Mac. If you don't have an iOS device you will need to find a third-party alternative. This page examines some options:
    http://rfwilmut.net/migrate4

  • JBO-25014: Another user has changed the row with primary key oracle.jbo.Key

    Hi,
    I am developing a Fusion Web Application using Jdeveloper 11.1.2.1.0. I have a home.jspx page that has a ADF table built on efttBilling View Object. . When you click on one of the rows in the table, it will take you to detail.jspx where you can edit the row and save. When 'save' is clicked, stored procedures are executed to update/insert rows into few tables , and then go back to home.jspx where you need to see updated content for that row.
    To get down to the exact issue, updates are made to the tables on which the efttBilling View Object is built using a stored procedure. Once this is done, I am trying to requery view object to see new content. But I keep getting JBO-25014: Another user has changed the row with primary key oracle.jbo.Key error. Following are the approaches I followed to query new results:
    a. Executed Application Modules Commit Method. Created 'Commit' Action binding and tied it to homePageDef.xml. Called this binding from a view scope bean.
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
         OperationBinding operationBinding = bindings.getOperationBinding("Commit");
        Object result = operationBinding.execute();
       if (!operationBinding.getErrors().isEmpty())
        return null;
    b. Marked 'Refresh on Insert' , 'Refresh on Update', 'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
    c. Tried to Requery View Object. Created a refreshViewObject method in Application Module Impl.java file, exposed this method to the client interface and created a invokeMethod Action binding in home.jspx
    Code in Application Module:
      public void refresheftTransactionsforBillingAccountViewObj1View()
        System.out.println("In eftTransactionsforBillingAccountViewObj1");
      findViewObject("eftTransactionsforBillingAccountViewObj1").executeQuery();
    Code in view scope bean
            DCBindingContainer bindings =
           (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding operation =
            bindings.getOperationBinding("refresheftTransactionsforBillingAccountViewObj1View");
            operation.execute();
    I have searched web, ADF forums and tried methods suggested in there but no sucess.
    Could anyone please provide some insight in this issue. I have been battling with this since quite some time. I can provide you with the log file too.
    Thanks!
    Shai.

    What code does your Commit method have .. can you try using the Commit executable from the AM itself instead ?
    Also -
    Shai wrote:
    'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
    which all attributes you set this property for . it should just be for History columns as such.
    Did you also check if this could be your scenario ?
    Decompiling ADF Binaries: Yet another reason for "JBO-25014: Another user has changed the row with primary key orac…
    OR
    JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
    OR
    Another user has changed the row with primary key -Table changed externally
    Message was edited by: SudiptoDesmukh

  • How To Store pdf or doc file in Oracle Database using Java Jdbc?

    can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.

    Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
    for Adding PDF in DB i used image.jsp
    Database table structure (table name. pictures )
    Name Null? Type
    ID NOT NULL NUMBER(11)
    IMAGE BLOB
    <%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
         PreparedStatement ps,pstmt,psmnt;
         ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =
    new File("D:/info.pdf");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,4);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("<h2>PDF inserted successfully");
    else{
    out.println("<h2>Problem in image insertion");
    catch(Exception e){
    out.println("<h2>Failed Due To "+e);
    %>
    O/P: PDF inserted successfully
    i tried to display that pdf using servlet. i am giving the code below.
    import java.io.IOException;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class DispPDF extends HttpServlet {
         * The doGet method of the servlet. <br>
         * This method is called when a form has its tag value method equals to get.
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              //response.setContentType("text/html"); i commented. coz we cant use response two times.
              //PrintWriter out = response.getWriter();
              try{
                   InputStream sPdf;
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
                        PreparedStatement ps,pstmt,psmnt;
                   psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
                        psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
                   ResultSet rs = psmnt.executeQuery();
                        if(rs.next()) {
                   byte[] bytearray = new byte[1048576];
                        //out.println(bytearray);
                        int size=0;
                        sPdf = rs.getBinaryStream(1);
                        response.reset();
                        response.setContentType("application/pdf");
                        while((size=sPdf.read(bytearray))!= -1 ){
                        //out.println(size);
                        response.getOutputStream().write(bytearray,0,size);
                   catch(Exception e){
                   System.out.println("Failed Due To "+e);
                        //out.println("<h2>Failed Due To "+e);
              //out.close();
    OP
    PDF-1.4 %âãÏÓ 2 0 obj <>stream xœ+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2‹ŠKüsSŠSŠS4C²€ê P”kø$V㙂GÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
    plz help me out.

  • I have a ipod, but recently updated my laptop, how do I get my ipod to sync with my new PC, when I connect the USB the ipod say's "connected" eject before disconnecting

    I have a ipod, but recently updated my laptop, how do I get my ipod to sync with my new PC, when I connect the USB the ipod say's "connected" eject before disconnecting

    See KB Article:  How to use your iPod to move your music to a new computer

  • Pse 11: How do you transfer a picture into a puzzle when using PSE 11?

    How do you transfer a picture into a puzzle when using PSE 11?

    Hello,
    because I work with PS CC I will give you some links, the first program is expressly made for PSE 11:
    PSE11: http://www.panosfx.com/commercial-free-photoshop-actions/puzzle-effects
    Here a Adobe Plugin:
    Adobe - Photoshop : For Windows : Photoshop CS5 Optional Plugins
    These links here may act as examples and maybe you cane use them too
    Create Jigsaw Puzzle Effect for Photos - Photoshop Tutorials - CSSCreme.com
    http://www.avbros.com/puzzlepro/index.html
    https://creative.adobe.com/addons/products/1069#.U_dkQ2NQQs0
    http://www.photoshopessentials.com/photo-effects/photoshop-puzzle/
    http://www.obsidiandawn.com/jigsaw-puzzle-pieces-photoshop-gimp-brushes
    Good luck!
    Hans-Günter

Maybe you are looking for

  • How to convert a key figure to Characteristic in BEx.

    Hello Experts, I have a key figure of type Quantity unit Second. Is there are way that I can convert this to a characteristic in BEx so that I can use in restrictions (range). Thanks in anticipation. Cheers.

  • HT5085 iTunes match: An unknown error occurred (4001)

    I just got the service yesterday but there's an error coming out any time I want to upload my songs. It says "We could not complete your iTunes store request. An unknown error occurred (4001). Does anyone knows what this means?

  • Adobe DPSSE for Android -- Why not?

    Can someone please help me understand why the refusal to offer this for Androids?  Is Adobe in an exclusive Apple contract or similar?  Please do not respond with stupid suggestions like "buy an apple".  We have costs concerns and not every company c

  • How do I remove a podcast episode

    I can't figure out how to remove old episodes of podcasts from my shuffle.  I've done all the syncing and resyncing I can think of and I've looked everywhere for a "delete" option.  Please help if you can!!!!   Thanks.

  • Mac OS: System log being filled with various "CGContext..." errors

    I've been troubleshooting an occasional FF26 hang (whereby the entire browser goes unresponsive for 10-15 seconds) and took a look at the system log. I'm running Mac OS Mavericks 10.9.1. The log is absolutely **inundated** with messages like this: <p