Populating Oracle table with CLOB Fields/Column type

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();
      }
}










mi_ckyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gnoonCommented:
You've closed the CLOB object twice in closeCLOB().
0
gnoonCommented:
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
gnoonCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mi_ckyAuthor Commented:
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
mi_ckyAuthor Commented:
feedback = gnoon
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.