www.gusucode.com > database 案例源码程序 matlab代码 > database/CloseDatabaseDatastoreObjectExample.m
%% Close |DatabaseDatastore| Object % Using a JDBC driver, create a database connection |conn| to a % Microsoft(R) SQL Server(R) database with Windows(R) authentication. % Specify a blank user name and password. The code assumes that you are % connecting to a database |toy_store|, a database server |dbtb04|, and % port number |54317|. conn = database('toy_store','','','Vendor','Microsoft SQL Server', ... 'Server','dbtb04','PortNumber',54317,'AuthType','Windows'); %% % Create a |DatabaseDatastore| object |dbds| using the database connection % |conn| and SQL query |sqlquery|. This SQL query retrieves all data from % the table |airlinesmall|. sqlquery = 'select * from airlinesmall'; dbds = databaseDatastore(conn,sqlquery); %% % Close the |DatabaseDatastore| object |dbds|. close(dbds)