Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Populating Oracle table with CLOB Fields/Column type

Posted on 2004-11-08
5
Medium Priority
?
535 Views
Last Modified: 2009-12-16
Hi there,

(standalone java app)
Using a standalone java app I am inserting bulk data retrieved from db2 into oracle table.  Everything works fine until I get to tables with clob fields.
I get error:
Io exception: Software caused connection abort: socket write error

Wot my code does is dynmically set up a preparedstatement with ?*  arguments based on how many columns are in the table of db2_database.

After getting all the data from db2 database i then do a (oracle) sendBatch( )  
and this is where it fails.  also I call the closeClob method just before the sendbatch
see code below.


Has anyone done this successfully- inserting bulk data into oralce 9.i tables with clob fields.
I am pretty stuck with this error.
Any suggestion on how to solve this would be greatly appreciated.
Thanks!!!!!!!!

 





public static CLOB getCLOB(int pos, String clobData) throws SQLException {
      
      
            try
                      {
            
            if (clobData == null && clobData.length() < 1){
                  
            return null;      
            }
            
            if (tempClob==null) {
            
            tempClob = CLOB.createTemporary(conn2, true, CLOB.DURATION_SESSION);
            tempClob.open(CLOB.MODE_READWRITE);
            }
                        
            
            tempClob.putString(pos, clobData);
            
        
      }
      catch(Exception ex ){
            System.out.println(ex.getMessage() );
            tempClob.freeTemporary();
      }
            
return tempClob;
}

// used for closing clob
public static void  closeCLOB() throws SQLException {
      
      try
      {
      System.out.println("About to close stream");      
      tempClob.close();      
      }
      catch(Exception ex){
            ex.printStackTrace();
            
      }
      finally{
            if (tempClob!=null)
                  tempClob.close();
      }
}










0
Comment
Question by:mi_cky
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:gnoon
ID: 12530179
You've closed the CLOB object twice in closeCLOB().
0
 
LVL 16

Expert Comment

by:gnoon
ID: 12530207
The error message seems to be printed in catch block in getCLOB(), but it's not enough to debug. Try to use ex.printStackTrace() to see what line cause the error.
0
 
LVL 16

Accepted Solution

by:
gnoon earned 1500 total points
ID: 12530261
0
 

Author Comment

by:mi_cky
ID: 12624732
Hey guys,

If u ever find yourself searching for this:
As feedback said its an oracle bug:
Solution is to download oracle 10g jdbc driver, include it your IDE and use the preparedstatement api
which as a new method called setStringForClob

Thanks feedback!!!!
0
 

Author Comment

by:mi_cky
ID: 12624761
feedback = gnoon
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question