Download MATLAB and matlab
MATLAB-SQL connection technology [pure code] code block
Code block syntax follows standard MATLAB code
Function conn_matlab dB () % UI 2015.6.27 MATLAB R2013b % function Description: establish a connection between matlab and Database SQL % JDBC connection method: install driver package-> Add path-> restart matlab %-> establish database connection (based on SQL Server 2008) % reference connection http://m.blog.csdn.net/blog/wang_306/37818681%% input (by this): Database Name, user name, password, drive name *, local server address * databasename = 'testdb'; username = 'testuser'; password = '******'; driver = 'com. mysql. jdbc. driver '; databaseurl = 'jdbc: mysql: // localhost: 3306/phpdb'; % create an SQL connection conn = database (databasename, username, password, driver, databaseurl ); ping (conn); % connection determination: 1 connected | 0 not connected to isconnection (conn); % get data in cell format curs = exec (conn, 'select * from Maid. tb_dw_addr '); %' indicates the SQL statement curs = fetch (curs); datacell = curs. data; % close connection close (curs); close (conn)
Summary
I haven't written a blog for a long time. I will stay here now and in the future.Zhejiang University of Technology, Continue to likeCodeMore and more things will be learned to cheer for yourself.
I want to communicate with you, my email: wangrui_key@163.com