where baos is a ByteArrayOutputStream. I was thinking if it's ok to store it in the database(through Java code) this way especially if I'm going to use PreparedStatement... Any help would be appreicated. Thanks guys!
posted 10 years ago
Most databases have a datatype specifically designed for Binary Large OBjects; this datatype is called "BLOB" and is what most people use to store image data in a database.
Most databases have internal limits on the size of character strings supported by the normal string datatypes, but many have an unlimited size string datatype, called CLOB (character large object). For your purposes, if they have CLOB, then almost certainly have BLOB, and you should be using that.
There are examples on the web for how to use these datatypes for images; try Google.