User`s guide
database
7-45
close(conn)
Connect to Microsoft SQL Server Using Windows Authentication
Connect to a Microsoft SQL Server database with integrated Windows Authentication
using a JDBC driver.
Use the AuthType parameter to establish a Windows Authentication connection. For
details about how to set up Windows Authentication and find your port number, see
“Microsoft SQL Server JDBC for Windows” on page 2-33.
conn = database('test_db','','',...
'Vendor','Microsoft SQL Server','Server','servername',...
'AuthType','Windows','portnumber',123456)
conn =
Instance: 'test_db'
UserName: ''
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 com.microsoft.sqlserver.jdbc.SQLServerConnection]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'
conn has an empty Message property, which indicates a successful connection.
Close the database connection conn.
close(conn)
Connect to Sybase Using a JDBC Driver URL
Connect to the database dbname using the user name username and password pwd. Use
the JDBC driver com.sybase.jdbc4.jdbc.SybDriver to make the connection. Use
the URL defined by the driver vendor including your server name, port number, and
database name. For details, see “Sybase JDBC for Windows” on page 2-97.
conn = database('dbname','username','pwd',...
'com.sybase.jdbc4.jdbc.SybDriver','URL')
conn =