Question

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.

Était-ce utile?

La solution

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:

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top