MATLAB: Can I set up a File DSN or a DSN-less database connection using the Database Toolbox 3.1.1 (R2006a)

databaseDatabase Toolboxdsndynamicfileodbcprogram

I would like to set up a DSN-less database connection using the Database Toolbox 3.1.1 (R2006a), or use a File DSN.
When I issue the following command at the MATLAB Command Prompt:
getdatasources
It does not list File DSN as a data source.

Best Answer

The ability to use File DSN is not available in the Database Toolbox 3.1.1 (R2006a).
To set up a DSN-less connection (i.e., a dynamic ODBC connection), first create a File DSN and use the generated parameter-value pairs to connect to your data base through a DSN-less connection :
Then do the following:
1. Go to Start->Settings->Control Panel->Administrative Tools->Data Sources(ODBC)
2. Create a File DSN for your database
3. Open the File DSN in a text editor and note the Driver, Server, DBQ, DriverID, and DefaultDir. Some of these properties may not be present in each driver.
4. Use these properties to build the Database URL string. The following are example connection strings for Oracle, MSSQL Server and MS Access.
For Oracle:
con = database('<Service Name>',<User>,<pwd>,'sun.jdbc.odbc.JdbcOdbcDriver','jdbc:odbc:Driver={<From File DSN>};Server=<From File DSN>;DBQ=<From File DSN>')
For MSSQL Server:
con = database('',<User>,<pwd>,'sun.jdbc.odbc.JdbcOdbcDriver','jdbc:odbc:Driver={<From File DSN>};Server=<From File DSN>;Database=<From File DSN>;Trusted_Connection=<From File DSN>')
For Access:
con = database('','','','sun.jdbc.odbc.JdbcOdbcDriver','jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=<From File DSN>)