Test Post: posting source code

Sample source code

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Sample source code initially collapsed

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Sample source code with line highlighting

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Link to my article on how to do this.

Advertisements

Reading from CLOB in java through JDBC

Here is a code snippet that I have used to read from a CLOB, Oracle 10g instance.

PreparedStatment ps = connection.prepareStatement
("SELECT clobcolumn from clobtable");
ResultSet rs = ps.executeQuery();
while(rs.next())
{
oracle.sql.CLOB clobValue = (oracle.sql.CLOB)rs.getCLOB(1);
BufferedReader reader = new BufferedReader(new
InputStreamReader(clobValue.getAsciiStream()));
String read = null;
StringBuffer buffer = new StringBuffer();
while((read = reader.readLine()) != null )
{
buffer.append(read);
}
}
Digg This