JDBC を使用して Matlab を介して postgresql データベースにアクセスしていますが、個々の値ではなく配列として保存したい値の配列を挿入しようとすると、ハングアップしました。私が使用しているMatlabコードは次のとおりです。
insertCommand = 'INSERT INTO neuron (classifier_id, threshold, weights, neuron_num) VALUES (?,?,?,?)';
statementObject = dbhandle.prepareStatement(insertCommand);
statementObject.setObject(1,1);
statementObject.setObject(2,output_thresholds(1));
statementObject.setArray(3,dbHandle.createArrayOf('"float8"',outputnodes(1,:)));
statementObject.setObject(4,1);
statementObject.execute;
close(statementObject);
配列を扱う行を除いて、すべてが適切に機能します。オブジェクト outputnodes は <5x23> double マトリックスなので、最初の <1x23> をテーブルに入れようとしています。
'"float8"'
createArrayof 呼び出しの一部で名前と引用符のさまざまな組み合わせを試しましたが、常に次のエラーが発生します。
??? Java exception occurred:
org.postgresql.util.PSQLException: Unable to find server array type for provided name "float8".
at org.postgresql.jdbc4.AbstractJdbc4Connection.createArrayOf(AbstractJdbc4Connection.java:82)
at org.postgresql.jdbc4.Jdbc4Connection.createArrayOf(Jdbc4Connection.java:19)
Error in ==> Databasetest at 22
statementObject.setArray(3,dbHandle.createArrayOf('"float8"',outputnodes(1,:)));