Clob

Clob (SQL CLOB 매핑)

SQL 타입 CLOB을 Java 프로그래밍 언어로 매핑한 것입니다. SQL CLOB은 데이터베이스 테이블 행의 열 값으로 Character Large Object를 저장하는 내장 타입이에요.

출처: Java API Reference

본문

기본적으로 드라이버는 SQL locator(CLOB)를 사용해 Clob 객체를 구현하며, 이는 Clob 객체가 CLOB 데이터 자체가 아니라 CLOB 데이터에 대한 논리적 포인터를 담음을 뜻합니다. Clob 객체는 생성된 트랜잭션 기간 동안 유효합니다.

Clob 인터페이스는 CLOB 값의 길이를 얻고, CLOB 값을 클라이언트에 materialize하고, CLOB 값 안에서 부분 문자열이나 Clob 객체를 검색하는 메서드를 제공합니다. ResultSet, CallableStatement, PreparedStatement 인터페이스의 getClob, setClob 같은 메서드로 SQL CLOB 값에 접근할 수 있어요. 추가로 CLOB 값을 갱신하는 메서드도 있습니다.

JDBC 드라이버가 이 데이터 타입을 지원한다면 Clob 인터페이스의 모든 메서드를 완전히 구현해야 합니다.

대표적인 메서드

long length() throws SQLException
String getSubString(long pos, int length) throws SQLException
Reader getCharacterStream() throws SQLException
long position(String searchstr, long start) throws SQLException
int setString(long pos, String str) throws SQLException
void truncate(long len) throws SQLException
void free() throws SQLException

더 알아보기 (Learn more)

Java 공식 API