Thread Subject: Fastinsert error

Subject: Fastinsert error

From: Sally

Date: 4 Nov, 2009 19:20:19

Message: 1 of 4

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

Subject: Fastinsert error

From: Sally

Date: 5 Nov, 2009 16:19:04

Message: 2 of 4

"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

Subject: Fastinsert error

From: Jesper Lauridsen

Date: 11 Nov, 2009 18:57:01

Message: 3 of 4

"Sally " <sd2383@columbia.edu> 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
> >


Hey Sally do you have any experience with access database? I need some help with the insert and update functions. My problem is

I investigate the possibility to use Access as a database. Therefore I tried to export data from matlab to Access.

I used the function:

colname={'Nike'};

exdata=[1;2;3];

insert(conn, 'New_Price', colname, exdata)

where 'New Price' is the name of the table and colname is the name of the column where the exdata is exported to. When I try to export exdata it all work fine. The only problem is that the exdata is allways copied to the end of the column Nike. My question is how can I control what row in the column Nike the exdata is exported to?
> > 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

Subject: Fastinsert error

From: Iqbal Nouyed

Date: 11 Jan, 2011 17:05:20

Message: 4 of 4

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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
database Sally 4 Nov, 2009 14:24:03
rssFeed for this Thread

Contact us at files@mathworks.com