سؤال

Title pretty much says everything.

This is what I tried;

Short[] messageObj = new Short[] { 1, 2, 3 };
PreparedStatement stmt = conn.prepareStatement("INSERT INTO table (audioData) VALUES (?)");
stmt.setArray(1, stmt.getConnection().createArrayOf("short", messageObj));
stmt.executeUpdate();

audioData column's type is varbinary(8200). I am not sure what to use.

هل كانت مفيدة؟

المحلول

The JConnector JDBC drivers map VARBINARY to the Java byte[] type. So you need to convert your Short[] into a byte[] before you can save them.

Reference:

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top