Java SQL Clob convertToString(Object obj)

Here you can find the source of convertToString(Object obj)

Description

convert To String

License

Open Source License

Declaration

public static String convertToString(Object obj) 

Method Source Code

//package com.java2s;
import java.sql.Clob;
import java.sql.SQLException;

public class Main {

    public static String convertToString(Object obj) {

        String value = "";
        try {// w w  w . j  av a 2 s  .  c o  m
            if (obj instanceof Clob) {
                value = ((Clob) obj).getSubString(1,
                        (int) ((Clob) obj).length());
            } else {
                value = String.valueOf(obj);
            }
            return value;
        } catch (SQLException | ClassCastException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. ConvertClobToString(StringBuffer sb, Clob clob)
  2. convertClob2String(Clob clob)
  3. convert(Object o, Class targetType)
  4. getClobToString(Clob clob)
  5. getRSClob(Object obj, String def)
  6. getFormattedClobColumn(final InputStream is)
  7. getString(Clob c)