2014-05-20 137 views
-1

我怎么能这个Java代码转换为MATLAB代码, 更换数据库的价值我想用MATLAB 请帮助TT解决方案使用MATLAB

    con2 = DriverManager.getConnection("jdbc:mysql://localhost/database","root", " ");  
        str = con2.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 


        String selectlastdb = "select * from table order by id desc limit 1"; 
        result = str.executeQuery(selectlastdb); 

        result.next(); 



        result.updateString("aa", "hello"); 
        result.updateString("bb", "bye"); 


        result.updateRow(); 

回答

1

MATLAB可以直接使用在数据库中更新特定细胞的价值Java(除非在没有JVM的情况下运行),请参阅docs中的更多内容。您应该可以重复使用您的大部分代码:

import java.sql.*; 

con2 = DriverManager.getConnection('jdbc:mysql://localhost/database','root', ' '); 
str = con2.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 

selectlastdb = 'select * from table order by id desc limit 1'; 
result = str.executeQuery(selectlastdb); 

result.next(); 

result.updateString('aa', 'hello'); 
result.updateString('bb', 'bye'); 

result.updateRow();