如何检查getBytes(coloulm name)在java中包含null值

时间:2016-06-10 07:42:10

标签: java jdbc

我想检查下面的语句是否为null

byte [] imageBytes = rs.getBytes(" doctimg");

我的代码是......

while(rs.next() ) {
    JsonObject row = new JsonObject();      

    /*Want  to Check this 
    byte[] imageBytes = rs.getBytes("doctimg");
    null or not*/
    byte[] imageBytes = rs.getBytes("doctimg");
    String imageBase64 = DatatypeConverter.printBase64Binary(imageBytes);

    row.add("doctId",new JsonPrimitive(""+rs.getString("doctId")));
    row.add("deptId",new JsonPrimitive(""+rs.getString("deptId")));


    row.addProperty("img", imageBase64);

    data.add(row);
}

1 个答案:

答案 0 :(得分:3)

您可以使用wasNull()方法:

minimumLineSpacing