Shujaat Farooqui
unread,Mar 24, 2013, 11:48:08 AM3/24/13You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
my problem is that i need to store 19 images from a folder to a MySQL database connected through ODBC connection.
this is my code:
%browse to select folder
pathfolder=uigetdir('C:\Users\Shujaat\Pictures','Select Folder Containing Images');
%calling function by sending pathfolder parameter and get
%return in fileList
fileList = getAllFiles(pathfolder);
%count number of files
numberOfJpegs=numel(fileList);
imagePath = cell(numberOfJpegs,1);
inData = cell(numberOfJpegs,1);
Im = cell(numberOfJpegs,1);
bData = cell(numberOfJpegs,1);
for i=1:numberOfJpegs,
imagePath{i} = fileList{i};
disp(imagePath{i});
inData{i}=imread(imagePath{i});
Im{i}=rgb2gray(inData{i});
bData{i}=reshape(Im{i},[],1);
end
%get max id from database
MaxID = getMaxID('Obj_ID','Objects_Registered');
%Create a cell array containing the values to insert in table.
exdata = {MaxID+1, get(handles.edit5,'String'),get(handles.edit6,'String'),bData{1},bData{2},bData{3},bData{4},bData{5},bData{6},bData{7},bData{8},bData{9},bData{10},bData{11},bData{12},bData{13},bData{14},bData{15},bData{16},bData{17},bData{18},bData{19}};
%Create a cell array containing the column names in weights" table.
colnames = {'Obj_ID','Obj_Name','Obj_Detail','Obj_Img0','Obj_Img10','Obj_Img20','Obj_Img30','Obj_Img40','Obj_Img50','Obj_Img60','Obj_Img70','Obj_Img80','Obj_Img90','Obj_Img100','Obj_Img110','Obj_Img120','Obj_Img130','Obj_Img140','Obj_Img150','Obj_Img160','Obj_Img170','Obj_Img180'};
%Insert the data into the database.
conn = database('Object_Database','','');
fastinsert(conn, nameTable, colnames, exdata)
i am getting this error:
Error using database/fastinsert (line 259)
Java exception occurred:
sun.jdbc.odbc.JdbcOdbcBatchUpdateException: [MySQL][ODBC 5.2(a) Driver][mysqld-5.6.10]Row
size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC
or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is
stored inline.
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.emulateExecuteBatch(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeBatchUpdate(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch(Unknown Source)
i don't know what to do...plz help me out through this error...any help will be appreciated