%% Edit Existing JDBC Data Source
% Using an existing JDBC data source configured for a Microsoft® SQL Server® database, set the database name.
%
% Edit the existing JDBC data source SQLServerDataSource.

opts = configureJDBCDataSource('Datasource','SQLServerDataSource')

% opts is a JDBCConnectionOptions object with these properties:
% Vendor — Database vendor name
% DataSourceName — Name of the data source
% DatabaseName — Name of the database
% Server — Name of the database server
% PortNumber — Port number
% AuthType — Authentication type
% JDBCDriverLocation — Full path of the JDBC driver file
%
% Set the database name to toystore_doc. The DatabaseName property contains the new database name.

opts = setConnectionOptions(opts,'DatabaseName','toystore_doc')

%
% Test the database connection with a blank user name and password. The testConnection function returns the logical 1, which indicates the database connection is successful.

username = "";
password = "";
status = testConnection(opts,username,password)

%
% Save the configured data source.

saveAsJDBCDataSource(opts)

%
% Copyright 2019 The MathWorks, Inc.