I resolved the problem my self ...The thing is i have used some sort of key word in the database creation left,right,top,bottom so it is so value is not inserted also no error where there should be error saying these are keyword or some other ..it took for ever for me to find out..
inserting values in MySQL database using matlab
5 ビュー (過去 30 日間)
古いコメントを表示
Anandakumar Selvaraj
2014 年 1 月 24 日
%# JDBC connector path
javaaddpath('C:\Program Files (x86)\MySQL\MySQL Connector J\mysql-connector-java-5.1.28-bin.jar')
%# connection parameteres
host = 'localhost'; %MySQL hostname
user = 'root'; %MySQL username
password = 'root';%MySQL password
dbName = 'liptrackingdb'; %MySQL database name
%# JDBC parameters
jdbcString = sprintf('jdbc:mysql://%s/%s', host, dbName);
jdbcDriver = 'com.mysql.jdbc.Driver';
conn = database(dbName, user , password, jdbcDriver, jdbcString);
if isconnection(conn)
qry = sprintf('INSERT INTO lipcountor(top,bottom,left,right) VALUES(%.3f,%.3f,%.3f,%.3f);',distAa,distBa,distCa,distDa);
display(qry);
fetch(exec(conn, qry));
else
display('MySql Connection Error');
end
the matlab console also display the value correctly
qry =INSERT INTO lipcountor(top,bottom,left,right) VALUES(25.000,24.000,30.000,36.000);
but the value is not inserted in the database there is not even error.help
I have also tried
fastinsert(conn, 'productTable', {'top','bottom','left','right'}, {distAa,distBa,distCa,distDa});
were error arries
Error using database/fastinsert (line 155)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'right from productTable LIMIT 0' at line
1
Error in GUI>pbfacedetection_Callback (line 673)
fastinsert(conn, 'productTable', {'top','bottom','left','right'},
{distAa,distBa,distCa,distDa});
0 件のコメント
採用された回答
Anandakumar Selvaraj
2014 年 2 月 8 日
1 件のコメント
JohnGalt
2016 年 5 月 20 日
if you don't have the database toolbox you can use: http://www.mathworks.com/matlabcentral/fileexchange/57195-niallhurley-mysql-matlab
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!