Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Poriblem in use of CLOB in Oracle with CachedRowSet

Monoranjan Gorai
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Here is the sample code which works fine in MSSQL but fails in Oracle:
String query1="SELECT EMRLabNameLkup.LAB_NAME, EMRLabRequestMaster.ICD9 FROM EMRLabNameLkup,EMRLabRequestMaster WHERE EMRLabRequestMaster.LAB_REQUEST_ID="+labRequestID+" AND EMRLabRequestMaster.LAB_ID=EMRLabNameLkup.LAB_ID";
CachedRowSet cachedRowSet1 =;;
if (cachedRowSet1.size() > 0) {
while ( {
labTest.setLabTestName("<b>Diagnosis Codes:</b> "+cachedRowSet1.getString("ICD9"));
catch(SQLException sqlException1) {
logger.error("sqlException1: "+sqlException1);


Note: ICD9 is a 'ntext' datatype in MSSQL

When I change datatype of ICD9 to CLOB in Oracle and execute the previouse code, it does not work

But following code works fine in Oracle:

String query1 = "SELECT EMRLabNameLkup.LAB_NAME, EMRLabRequestMaster.ICD9 FROM EMRLabNameLkup,EMRLabRequestMaster WHERE EMRLabRequestMaster.LAB_REQUEST_ID="+ labRequestID
+ " AND EMRLabRequestMaster.LAB_ID=EMRLabNameLkup.LAB_ID";
Connection con=null;
Statement statement = con.createStatement();
ResultSet resultSet = statement.executeQuery(query1);
try {
while ( {
Clob cb=resultSet.getClob("ICD9");
InputStream is=cb.getAsciiStream();
InputStreamReader inR = new InputStreamReader( is );
BufferedReader buf = new BufferedReader(inR);
String line="";
String diagnosisCodes="";
while ( ( line = buf.readLine() ) != null ) {
labTest.setLabTestName("<b>Diagnosis Codes:</b> "+ diagnosisCodes);
} catch (SQLException sqlException1) {
logger.error("sqlException1: " + sqlException1);

I am using CachedRowSet in my application, therefore I need to acheive the retrieval of CLOB data using CachedRowSet in Oracle.

Please help me so that I can acheive the same
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic