Java::OracleSql::CLOB to text/string

I am using ojdbc8- and create connection to an Oracle database.

connection = java.sql.DriverManager.getConnection(“jdbc:oracle:thin:@” + connect_string,
user,password )
statement = connection.create_statement
result_set = statement.execute_query(sql_statement)

One of the columns that the query returns is a CLOB
For Ruby its class is : Java::OracleSql::CLOB

How can convert this to a string ?

Regards Hans

I’ve never used this, but a search for the api throws up:

does something like this work?

str = result_set.getSubString(1, result_set.length)

Will give it a try!

Yes it works.:

r =
str = r.getSubString(1, result_set.length)


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs