Class JdbcClob

  • TheJdbcClob class represents a JDBC Clob and provides methods for working with large character data.

  • Methods are available to retrieve the Clob content as an Apps Script Blob or a substring.

  • You can get the length of the Clob and find the position of a substring or another Clob within it.

  • Methods are provided to write strings or BlobSource data to the Clob at a specified position.

  • The Clob can be truncated to a specified length, and resources associated with it can be freed.

JdbcClob

A JDBCClob. For documentation of this class, seejava.sql.Clob.

Methods

MethodReturn typeBrief description
free()voidFor documentation of this method, seejava.sql.Clob#truncate(long).
getAppsScriptBlob()BlobGets the content of this JdbcClob as an Apps Script blob.
getAs(contentType)BlobReturn the data inside this object as a blob converted to the specified content type.
getSubString(position, length)StringFor documentation of this method, seejava.sql.Clob#getSubString(long, int).
length()IntegerFor documentation of this method, seejava.sql.Clob#length().
position(search, start)IntegerFor documentation of this method, seejava.sql.Clob#position(Clob, long).
position(search, start)IntegerFor documentation of this method, seejava.sql.Clob#position(String, long).
setString(position, blobSource)IntegerConvenience method for writing aJdbcClob to a clob.
setString(position, blobSource, offset, len)IntegerConvenience method for writing aJdbcClob to a clob.
setString(position, value)IntegerFor documentation of this method, seejava.sql.Clob#setString(long, String).
setString(position, value, offset, len)IntegerFor documentation of this method, seejava.sql.Clob#setString(long, String, int, int).
truncate(length)voidFor documentation of this method, seejava.sql.Clob#truncate(long).

Detailed documentation

free()

For documentation of this method, seejava.sql.Clob#truncate(long).


getAppsScriptBlob()

Gets the content of this JdbcClob as an Apps Script blob.

Return

Blob — ABlob that can be used directly by other Apps Script APIs.


getAs(contentType)

Return the data inside this object as a blob converted to the specified content type. Thismethod adds the appropriate extension to the filename—for example, "myfile.pdf". However, itassumes that the part of the filename that follows the last period (if any) is an existingextension that should be replaced. Consequently, "ShoppingList.12.25.2014" becomes"ShoppingList.12.25.pdf".

To view the daily quotas for conversions, seeQuotas for GoogleServices. Newly created Google Workspace domains might be temporarily subject to stricterquotas.

Parameters

NameTypeDescription
contentTypeStringThe MIME type to convert to. For most blobs,'application/pdf' is the only valid option. For images in BMP, GIF, JPEG, or PNG format, any of'image/bmp','image/gif','image/jpeg', or'image/png' are also valid. For a Google Docs document,'text/markdown' is also valid.

Return

Blob — The data as a blob.


getSubString(position, length)

For documentation of this method, seejava.sql.Clob#getSubString(long, int).

Parameters

NameTypeDescription
positionIntegerThe index of the first character of the substring to extract. The first character is at index 1.
lengthIntegerThe number of consecutive characters to copy (must be 0 or greater).

Return

String — The retrieved substring.


length()

For documentation of this method, seejava.sql.Clob#length().

Return

Integer — The length (in characters) of this clob.


position(search, start)

For documentation of this method, seejava.sql.Clob#position(Clob, long).

Parameters

NameTypeDescription
searchJdbcClobThe clob object to search for.
startIntegerThe position at which to begin searching; the first position is 1.

Return

Integer — The position at which the specifed clob appears, or -1 if it is not present.


position(search, start)

For documentation of this method, seejava.sql.Clob#position(String, long).

Parameters

NameTypeDescription
searchStringThe substring to search for.
startIntegerThe position at which to begin searching; the first position is 1.

Return

Integer — The position at which the specifed substring appears, or -1 if it is not present.


setString(position, blobSource)

Convenience method for writing aJdbcClob to a clob.

Parameters

NameTypeDescription
positionIntegerThe position at which writing to the clob starts; the first position is 1.
blobSourceBlobSourceThe blob source to write.

Return

Integer — The number of characters written.


setString(position, blobSource, offset, len)

Convenience method for writing aJdbcClob to a clob.

Parameters

NameTypeDescription
positionIntegerThe position at which writing to the clob starts; the first position is 1.
blobSourceBlobSourceThe blob source to write.
offsetIntegerThe offset into the provided string where reading characters to write starts.
lenIntegerThe number of characters to write.

Return

Integer — The number of characters written.


setString(position, value)

For documentation of this method, seejava.sql.Clob#setString(long, String).

Parameters

NameTypeDescription
positionIntegerThe position at which writing to the clob starts; the first position is 1.
valueStringThe string to write.

Return

Integer — The number of characters written.


setString(position, value, offset, len)

For documentation of this method, seejava.sql.Clob#setString(long, String, int, int).

Parameters

NameTypeDescription
positionIntegerThe position at which writing to the clob starts; the first position is 1.
valueStringThe string to write.
offsetIntegerThe offset into the provided string where reading characters to write starts.
lenIntegerThe number of characters to write.

Return

Integer — The number of characters written.


truncate(length)

For documentation of this method, seejava.sql.Clob#truncate(long).

Parameters

NameTypeDescription
lengthIntegerThe size (in bytes) of this clob after truncation.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.