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 = "SELECT Name, type FROM MSysObjects where MSysObjects.Name = \"Table1\" and type = 1";
%>
<%= sqlTestForTable %>
<%
try {
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbcdbc:Commodities";
String userName = null;
String password = null;
Class.forName(driverName);
out.println("<br>Before conn <br>"
Connection connection = DriverManager.getConnection(connectionURL, userName, password);
out.println("After conn<br>"
Statement statement = connection.createStatement();
out.println("Before exec<br>"
statement.execute(sqlTestForTable);
out.println("After Exec<br>"
ResultSet rs = statement.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int numCol = rsmd.getColumnCount();
out.println("<tr>"
if (rs.next())
{
System.out.println("Table found<br>"
}
else
{
System.out.println("Table not found<br>"
}
rs.close();
statement.close();
connection.close();
}
catch (Exception e ) {
out.println("<br> had this problem: " + e.getMessage());
e.printStackTrace();
}
%>
It seems to have a problem with the statement:
statement.execute(sqlTestForTable);
Again, thanks.
<%
String sqlTestForTable = "SELECT Name, type FROM MSysObjects where MSysObjects.Name = \"Table1\" and type = 1";
%>
<%= sqlTestForTable %>
<%
try {
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbcdbc:Commodities";
String userName = null;
String password = null;
Class.forName(driverName);
out.println("<br>Before conn <br>"
Connection connection = DriverManager.getConnection(connectionURL, userName, password);
out.println("After conn<br>"
Statement statement = connection.createStatement();
out.println("Before exec<br>"
statement.execute(sqlTestForTable);
out.println("After Exec<br>"
ResultSet rs = statement.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int numCol = rsmd.getColumnCount();
out.println("<tr>"
if (rs.next())
{
System.out.println("Table found<br>"
}
else
{
System.out.println("Table not found<br>"
}
rs.close();
statement.close();
connection.close();
}
catch (Exception e ) {
out.println("<br> had this problem: " + e.getMessage());
e.printStackTrace();
}
%>
It seems to have a problem with the statement:
statement.execute(sqlTestForTable);
Again, thanks.