db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunitha Kambhampati (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-302) Takes over 3 minutes to insert a 500kb String into CLOB
Date Fri, 20 May 2005 18:58:52 GMT
     [ http://issues.apache.org/jira/browse/DERBY-302?page=comments#action_65878 ]
     
Sunitha Kambhampati commented on DERBY-302:
-------------------------------------------

using setString instead of setCharacterStream in this case ( insert of 500kb clob) performs
way much better.   But ofcourse, setString cannot be used for large data (or data that wont
fit into memory) and one would need to use streams.

Inserting a 500kb blob using setBinaryStream is also much faster than the setCharacterStream.





 



> Takes over 3 minutes to insert a 500kb String into CLOB
> -------------------------------------------------------
>
>          Key: DERBY-302
>          URL: http://issues.apache.org/jira/browse/DERBY-302
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: Windows XP Professional, Dell Pentium IV
>     Reporter: Glenn Orbon

>
> I downloaded a Cloudescape Version 10 from here http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0408cline/index.html.
 Not sure exactly which version of 10 this is.
> Would like to store up to a 10MB XML string in a CLOB.  However, I noticed it took over
3 minutes to insert a 500kb string.  I am using the PreparedStatement to get around the 37kb
limitation encountered in a previous issue.  It takes less than 2 seconds to insert a 500kb
string into a CLOB in mySQl.
> Here the snippet:
>       FileReader fr = new FileReader ("sample.txt");  
>       BufferedReader br = new BufferedReader(fr);
>       String record = null;
>       try {
>         while ( (record=br.readLine()) != null ) {
>           bufferStr.append( record );
>       }
>       } catch (IOException e) {
>       //
>       // put your error-handling code here
>       //
>          System.out.println("Error reading file");
>       }
>       System.out.println("Size of inputStr: "+bufferStr.length() );
>       
>       PreparedStatement ps = mm.connection.prepareStatement("INSERT into  documents 
         VALUES (?,?)" );
>       ps.setInt(1, 13 );
>       StringReader reader1 = new StringReader(bufferStr.toString());
>       ps.setCharacterStream(2, reader1, bufferStr.length());
>       System.out.println("Uploading string....");
>       ps.execute();
>       System.out.println("Done uploading string...");
>       mm.connection.commit();
> Thanks for your the help,
> Glenn O.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message