import java.sql.Clob;

import javax.sql.rowset.serial.SerialClob;


    /**
     * Clob 转 String
     */
    public static String getString(Clob c) {
        try {
            return c.getSubString(1, (int) c.length());
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * String 转 Clob
     */
    public static Clob getClob(String s) {
        try {
            return new SerialClob(s.toCharArray());
        } catch (Exception e) {
            return null;
        }
    }

 

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐