Создан стол с блобом
CREATE TABLE SUGGEST_DATA (
LOCALE VARCHAR2(20) NOT NULL,
DATA_COLLECTION blob,
UPDATED_ON TIMESTAMP,
PRIMARY KEY (LOCALE)
)
с использованием приведенного ниже кода для вставки хеш-таблицы (ключ = строка, значение = ArrayList of String) в таблицу выше.
Java-код: -
conn = getDBConnection();
stmt = conn.prepareStatement("INSERT INTO SUGGEST_DATA (LOCALE,DATA_COLLECTION,UPDATED_ON) VALUES (?, ?, ?)");
stmt.setString(1, locale);
stmt.setObject(2, data);//this is a java hashtable
stmt.setTimestamp(3, new Timestamp(System.currentTimeMillis()));
stmt.executeUpdate();
сбой в "stmt.setObject"
java.sql.SQLException: Invalid column type
at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:11256)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:10605)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:11665)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:11631)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:253)