How do i get clob data using java and assign to a variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #31
    Originally posted by kanthi84
    CAN U TELL ME WAT IS WRONG WITH THE CODE.
    THE CODE IS NOT EXECUTING


    pstmt=con.prepa reStatement("IN SERT INTO TABLE values('','','' ,?,'','','')");
    oracle.sql.CLOB newClob =oracle.sql.CLO B.createTempora ry(con, false, oracle.sql.CLOB .DURATION_CALL) ;
    newClob.putStri ng(1,VALUE);
    pstmt.setClob(4 , newClob);
    int rowcnt = pstmt.executeUp date();

    THANK U IN ADVANCE
    What is the full Exception that you get when you execute it?

    Comment

    • kanthi84
      New Member
      • Feb 2007
      • 37

      #32
      Getting the item ParentID:java.l ang.NullPointer Exception

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #33
        Originally posted by kanthi84
        Getting the item ParentID:java.l ang.NullPointer Exception
        Now which line in your code is giving that exception.

        Comment

        • kanthi84
          New Member
          • Feb 2007
          • 37

          #34
          THE EXCEPTION IS GETTING AFTER THE FOLLOWING LINE


          oracle.sql.CLOB newClob =oracle.sql.CLO B.createTempora ry(con, false, oracle.sql.CLOB .DURATION_CALL) ;

          AFTER THIS LINE,ST.CLOSE() IS EXCECUTED AND EXCEPTION IS DISPLAYED

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #35
            Originally posted by kanthi84
            THE EXCEPTION IS GETTING AFTER THE FOLLOWING LINE


            oracle.sql.CLOB newClob =oracle.sql.CLO B.createTempora ry(con, false, oracle.sql.CLOB .DURATION_CALL) ;

            AFTER THIS LINE,ST.CLOSE() IS EXCECUTED AND EXCEPTION IS DISPLAYED
            If you are sure that's the line throwing the nullpointer exception then check your value of con. It could be the one that is null at the time of call. Where are you getting it from?

            Comment

            • kanthi84
              New Member
              • Feb 2007
              • 37

              #36
              con=DBConnectio n.getConnection ();

              Comment

              • kanthi84
                New Member
                • Feb 2007
                • 37

                #37
                con=DBConnectio n.getConnection ();


                THIS IS THE STATEMENT FOR GETTING CONNECTION.
                AND THE CONNECTION IS CLOSED ONLY AFTER THOSE STATEMENTS.

                Comment

                • r035198x
                  MVP
                  • Sep 2006
                  • 13225

                  #38
                  Originally posted by kanthi84
                  con=DBConnectio n.getConnection ();


                  THIS IS THE STATEMENT FOR GETTING CONNECTION.
                  AND THE CONNECTION IS CLOSED ONLY AFTER THOSE STATEMENTS.
                  You might have the post all the code then ...

                  Comment

                  • kanthi84
                    New Member
                    • Feb 2007
                    • 37

                    #39
                    private void Details(String A,String B,String C,String D)
                    {
                    Clob tempClob = null;
                    try
                    {
                    con=DBConnectio n.getConnection ();

                    pstmt=con.prepa reStatement("IN SERT INTO TABLE values('','"+A+ "','',EMPTY_CLO B(),'"+B+"','"+ D+"','')");
                    tempClob = (Clob) oracle.sql.CLOB .createTemporar y(con, false,oracle.sq l.CLOB.DURATION _SESSION);
                    ((oracle.sql.CL OB) tempClob).putSt ring(1, C);
                    pstmt.setClob(4 , tempClob);
                    pstmt.executeUp date();
                    }

                    catch(SQLExcept ion e)
                    {
                    System.out.prin tln("Getting the item ParentID:"+e);
                    }
                    catch(Exception e)
                    {
                    System.out.prin tln("Getting the item ParentID:"+e);
                    }
                    finally
                    {
                    try{
                    pstmt.close();
                    st.close();
                    con.close();
                    }catch(SQLExcep tion e)
                    {
                    System.out.prin tln(e);
                    }
                    }
                    }

                    Comment

                    Working...