zhanghong920
Programmer
Thanks for your help for my precious question. Now I'm using jdbc to save the resulting data from a service to a mysql database. The field is defined to be Blob because the data maybe very large and different in length. The code is as below:
PreparedStatement insertCommand;
insertCommand = connection.prepareStatement("insert into filter values('?', '?', '?')"
;
insertCommand.setString(3, metadataString);
/*metadataString is the large data string I want to save to the database, produced from baos.toString(), where baos is a ByteArrayOutputStream object. */
But it has the error when I run it:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at com.mysql.jdbc.PreparedStatement.set(Unknown Source)
at com.mysql.jdbc.PreparedStatement.setString(Unknown Source)
at ....
Anything wrong in my code? Thanks a lot,
zhanghong920
PreparedStatement insertCommand;
insertCommand = connection.prepareStatement("insert into filter values('?', '?', '?')"
insertCommand.setString(3, metadataString);
/*metadataString is the large data string I want to save to the database, produced from baos.toString(), where baos is a ByteArrayOutputStream object. */
But it has the error when I run it:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at com.mysql.jdbc.PreparedStatement.set(Unknown Source)
at com.mysql.jdbc.PreparedStatement.setString(Unknown Source)
at ....
Anything wrong in my code? Thanks a lot,
zhanghong920