Java::OracleSql::CLOB to text/string

I am using ojdbc8-19.3.0.0.jar 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: https://docs.oracle.com/javase/8/docs/api/java/sql/Clob.html#getSubString-long-int-

does something like this work?

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

Will give it a try!
Thanks.

Yes it works.:

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

Super

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