views:

48

answers:

1

Hi!

I'm trying to get a listing of all tables in an Access database using Matlab.

I'm so far using an actxobject and can successfull run queries against the database, but all methods I've read here have failed.

I consistently get the error message 'No read permission on MSysObjects'. The query runs fine within the Access-program, but the implementation of my program does not allow me to store the query there.

So, my question is: Is there any way to list all the tables of an Access database through Matlab?

+3  A: 

Consider this code:

conn = actxserver('ADODB.Connection');
connString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwind.mdb';
conn.Open(connString);

rs = conn.OpenSchema('adSchemaTables').GetRows;
tableNames = rs(3, ismember(rs(4,:),'TABLE') );

and the result is:

>> tableNames'
ans = 
    'Categories'
    'Customers'
    'Employees'
    'Order Details'
    'Orders'
    'Products'
    'Shippers'
    'Suppliers'
Amro
That seems to have done the trick. Thanks!
Nubsis

related questions