Hi,
I am using the following code to read clob data from teradata.
String ClobString; StringBuilder clobStringBuilder = new StringBuilder(); Clob clobData = rs.getClob("clobcolumn"); if(clobData != null) { int length = (int) rs.getClob("clobcolumn").length(); int BUF_LEN = 4096; char[] bufr = new char[length]; BufferedReader buffReader = new BufferedReader(clobData.getCharacterStream()); try { //buffReader.read(bufr); buffReader.read(bufr, 0, length); //buffReader.read(bufr, 0, BUF_LEN); /*int c = 0; while((c=buffReader.read(bufr,0,BUF_LEN)) != -1) { clobStringBuilder.append(bufr); }*/ /*while (null != (clobString = buffReader.readLine())) { clobStringBuilder.append(clobString); }*/ } catch (IOException e) { e.printStackTrace(); } finally { try { buffReader.close(); } catch (IOException e) { e.printStackTrace(); } clobData.free(); } String str = new String(bufr);
I have tried various options. My table contains 230 rows with 3 clob columns and each column contains around 7000 characters.
The above code is taking between 30-35 seconds to read all data. Please let me know, if there is any efficient way of reading clob data.
teradata database : 14.10
Am using the terdata jdbc driver version : 14.0.0.40
Regards,
Suresh.
Forums: