tags:

views:

131

answers:

2

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?

+1  A: 

I avoid storing images in the database as it takes up a lot of space, they are slow to retrieve, and can't be indexed or searched usefully. Are you sure you want to do this?

RedFilter
Absolutely not but it's something I have to live with!
Jonathan
+2  A: 

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.

LuRsT
Yes, I agree with you.
Jonathan