Jonathan
Jonathan

Reputation: 41

Grooviest way to store a BLOB in a database?

While writing a utility script to insert images into a database I wondered if there were a groovier way of doing it. In the end settled for something along the lines of this:

def sql = Sql.newInstance(...)
// ...    
Connection conn = sql.getConnection()
PreparedStatement stmt.prepareStatment(...)
stmt.setBinary(...)
stmt.executeUpate()

There must be a groovier way, can someone enlighten me?

Upvotes: 0

Views: 1199

Answers (1)

LuRsT
LuRsT

Reputation: 4103

A "Groovier" way could be just storing the path were you'd store the images.

Storing the images in a directory and storing just the path in the db is the best way.

Upvotes: 2

Related Questions