I want to get the list of tables in an MS access DB into my Java program. I wrote the below code but it giving me "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'MsysObjects'." Eventhough I used the admin login.
.... Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:sampledb"; Connection con = DriverManager.getConnection(url,"admin",""); PreparedStatement getTablesList = con.prepareStatement("SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') AND (Left$([Name],4) <> 'Msys') AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;"); ResultSet rs1 = getTablesList.executeQuery(); .......
Is there any other way to access the list of tables in the DB?
Some more information is required from you for this problem before it can be answered completely Like what are the available users in MS-Acess and have you checked the rights on the tables. I believe there must be some sysuser who must be defined as owner of this objects
SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
posted 12 years ago
Thanks for the reply!
There is only one user in this database which is very small and it is "admin" who has all the rights. There is no sysadmin or sysuser.