Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading the MSysObjects table in MS Access

Status
Not open for further replies.

mcklsn

Programmer
Mar 16, 2003
40
US
I am trying to read the MSysObjects table in MS Access in a JSP, but I get an error saying I don't have permission. How do I go about getting permission to read this table? I'm pretty new at this and I don't have a clue as to how to handle this problem. I am including the short test program I'm using to figure out how to do what I want to do. Eventually, I want to query the MSysObjects table to see if a certain table exists in the DB. Any help would be greatly appreciated.

<%
String sqlTestForTable = &quot;SELECT Name, type FROM MSysObjects where MSysObjects.Name = \&quot;Table1\&quot; and type = 1&quot;;
%>
<%= sqlTestForTable %>
<%
try {
String driverName = &quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;;
String connectionURL = &quot;jdbc:eek:dbc:Commodities&quot;;
String userName = null;
String password = null;
Class.forName(driverName);
out.println(&quot;<br>Before conn <br>&quot;);
Connection connection = DriverManager.getConnection(connectionURL, userName, password);
out.println(&quot;After conn<br>&quot;);
Statement statement = connection.createStatement();
out.println(&quot;Before exec<br>&quot;);
statement.execute(sqlTestForTable);
out.println(&quot;After Exec<br>&quot;);
ResultSet rs = statement.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int numCol = rsmd.getColumnCount();
out.println(&quot;<tr>&quot;);
if (rs.next())
{
System.out.println(&quot;Table found<br>&quot;);
}
else
{
System.out.println(&quot;Table not found<br>&quot;);
}
rs.close();
statement.close();
connection.close();
}
catch (Exception e ) {
out.println(&quot;<br> had this problem: &quot; + e.getMessage());
e.printStackTrace();
}
%>

It seems to have a problem with the statement:

statement.execute(sqlTestForTable);

Again, thanks.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top