|
Hi Sally,
I don't understand your solution, please help me out here, I have a cell-array variable containing, 1x64 cells, where each containing 1x256 array of integer values.
I have a mysql database table of the following schema,
CREATE TABLE IF NOT EXISTS `feresys`.`faces` (
`face_id` INT(11) NOT NULL AUTO_INCREMENT ,
`local_hist` INT(11) NULL DEFAULT NULL ,
`user_id` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`face_id`) ,
UNIQUE INDEX `user_id_UNIQUE` (`user_id` ASC) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
I want to insert the following data into the table
id size 1x4 ( eg. '1001')
local_hist size 1x64x256 which is a cell array containing gray_scale histogram of 64 regions of an image, which are all integers 0-255.
I've used the following lines to perform the insertion:
conn = database('dbname', '', '', 'com.mysql.jdbc.Driver', 'jdbc:mysql://localhost:3306/dbname');
extdata = {LH, id};
colnames = {'local_hist', 'user_id'};
tblname = 'tbname';
fastinsert(conn, tblname, colnames, extdata);
But i get the following error message:
?? No method 'setInt' with matching signature found for class
'com.mysql.jdbc.JDBC4PreparedStatement'.
Error in ==> database.fastinsert at 181
StatementObject.setInt(j,tmp) %INTEGER
Can you please help me how to solve this problem?
Thanks in advance
"Sally" wrote in message <hcutto$e9e$1@fred.mathworks.com>...
> "Sally " <sd2383@columbia.edu> wrote in message <hcsk5j$qkn$1@fred.mathworks.com>...
> > Hi,
> >
> > I am using fastinsert() of the Database Toolbox to insert new records into a table.
> >
> > The function works fine with data in the form of matrices and single row cell arrays, e.g., a cell array of the form:
> > data= {1x1 cell} [1x1 double]
> >
> > But it returns an error for cell arrays with more than 1 row, e.g.:
> > data= {2x1 cell} [2x1 double]
> >
> > Error message:
> > ??? No constructor java.lang.String with matching signature found
> > Error in ==> database.fastinsert at 155
> > StatementObject.setString(j,java.lang.String(tmp)) %CHAR, LONGVARCHAR, VARCHAR
> >
> > Does anyone know if the cell array needs to be in a particular format, or if this is a bug?
> >
> > Thanks in advance,
> > Sally
>
> I figured this out - for anyone else interested, the cell array needs to look like:
> {1x1 cell} [double]
> {1x1 cell} [double]
>
> See:
> http://www.mathworks.com/support/solutions/en/data/1-98WCCG/?solution=1-98WCCG
|