Skip to Content
Former Member
Jul 28, 2008 at 03:10 PM

Custom Table : table or view does not exist



I'm running a Netweaver 7.0 portal and have developed a custom Web Dynpro application. It works great. To support more features I added a custom table to the portal database schema (SAP<sid>DB). However, when I try to access the table from within code I get the following SQL message: table or view does not exist. I can access all the SAP portal tables just fine - just not the new one I created. I've asked DBAs to verify permissions; they've looked but can't figure out what the problem is.

Here's the code:

InitialContext dbInitContext = new InitialContext();
Properties sysProperties = System.getProperties();
String sysname = sysProperties.getProperty("SAPSYSTEMNAME");
String dbName = "jdbc/" + "SAP" + sysname + "DB";
DataSource dataSource = (DataSource) dbInitContext.lookup(dbName);
Connection conn = dataSource.getConnection();
String tableName = wdContext.currentContextElement().getTableName();
String SelectStmt = "Select * from" .concat(" " + tableName);
// Prepare the SQL statements
PreparedStatement stmt = conn.prepareStatement(SelectStmt);
// Execute the Query
ResultSet resultSet = stmt.executeQuery();

Any ideas where we've gone astray or what we might check? Any idea what permissions we need to set?