This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, Problem here is I can retrieve all the table names from DB using con.getMetadata.getTables(). This returns all the tables in the DB irrespective of wether user(used in connection string) has privileges or not. SO in next step when I am using one of the tables from the fetched result set, I get 'table or view does not exist'.
I tried to get privileges with con.getMetadata.getTablePrivileges(null,null,tablename). This narrows the tables further but still when I do a select in some of this table I face the same issue 'table or view does not exist'.
What database is this? Different databases handle metadata differently. You could perform the query inside of a try/catch block and assume a catch means the table is unaccessible, but I imagine there's a better route.
I guess thats hard way of doing it.. :-) though I tried but the problem is not solved by that.
One more thing, I face in this is even though from getPrivileges() I filter out some tables for which SELECT is permitted (as they are retunred from teh method), still it says table or view does not exist. Infact it seems to be correct, I couldnt access those tables on DB. So what this method actually gives is still a mistery for me.