Forum Discussion

naveenshetty's avatar
naveenshetty
New Contributor
6 years ago

groovy blob read

hi,

 

Can you please help me here ,

In the oracle database one of the cloumn "Token" stored as BLOB I want to read this and update meta data and store back to database.

could you please help me on this?

 

So far I tried with 

 

import groovy.sql.Sql
import java.sql.*

sql = Sql.newInstance("jdbc:oracle:thin:@servername.muc:port:sid", "username", "pw")
//selct blob
java.sql.Blob blob = sql.firstRow("SELECT TOKEN FROM oauth_access_token").blob
byte[] bdata = blob.getBytes(1, (int) blob.length());
String text = new String(bdata);
log.info text;

 

saved this code as .groovy and ran it in my local machine , getting 

Caught: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1541:tb2vrdeu
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1541:tb2vrdeu
at script.run(script.groovy:4)

 

 

4 Replies