User`s guide

7 Functions — Alphabetical List
7-48
Fetch data from the database.
curs = exec(conn,'SELECT ALL January FROM salesVolume');
curs = fetch(curs);
data = curs.Data;
Close the database connection conn.
close(conn)
Connect to PostgreSQL Using a JDBC Driver
Connect to a PostgreSQL database using name-value pair arguments to specify the
vendor and connection options.
Connect to the database test_db using the user name username and password pwd
on the machine remotehost. For details, see “PostgreSQL JDBC for Windows” on page
2-76.
conn = database('test_db','username','pwd','Vendor','PostgreSQL',...
'Server','remotehost')
conn =
Instance: 'test_db'
UserName: 'username'
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 org.postgresql.jdbc4.Jdbc4Connection]
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)
Input Arguments
instance — Data source setup or database name
string