Matlab-sql connection technology [pure code] code block
code block syntax follows standard MATLAB code
function conn_matlabdb() % Rui 2015.6.27 MATLAB r2013b% Function Description: Establish MATLAB and database SQL connection% using JDBC connection method: Install driver package, add path, restart Matlab% to establish a database connection (based on SQL Server)% Reference Connection http://m.blog.csdn.net/blog/wang_306/37818681Percent input (in this): database name, user name, password, drive name *, local server address *DatabaseName =' Matlabdb '; username =' Matlabuser ';p Assword =' ****** ';d river =' Com.mysql.jdbc.Driver ';d Atabaseurl =' Jdbc:mysql://localhost:3306/matlabdb ';Percent build SQL connectionconn = database (databasename, username, password, driver, databaseurl);p ING (conn);Percent Connection determined: 1 connected | 0 Not ConnectedIsconnection (conn);Percent gain data for cell formatCURS=EXEC (Conn,' select * from Matlabdb.tb_dw_addr ');% ' in SQL statementCurs=fetch (curs);d Atacell =Curs.Data;Percent close connectionClose (curs); Close (conn)
Summarize
No blog, now and later will continue to stay at Zhejiang University of Science and Technology , continue to like code , learn more and more, to their own refueling.
Want to communicate with everyone, my e-mail: [Email protected]
Matlab-sql Connection Technology