Reputation: 8480
I'm trying to store MediumBlob data in MySQL using java. But I have no success to retrieve the data.
To store I'm using:
PreparedStatement = stmt conn.prepareStatement("UPDATE INTO table VALUE(?)");
ByteArrayInputStream bais = new ByteArrayInputStream(data);
stmt.setBinaryStream(position, bais, data.length);
Is there correcty?
Upvotes: 2
Views: 2931
Reputation: 8480
I fix it!!!!
The problem was when I was retrieving the data. I was calling:
ResultSet.getClob
But I should call:
ResultSet.getBinaryStream
I have used setBinaryStream to input data!
This was confusing because I have a Clob field, and I was expecting retrieving a Clob field in Java code!
Upvotes: 1