I am trying to run the following sql using
Statement s = connection.createStatement();
ResultSet result = s.executeQuery(command);
while (result.next()) { ... }
The sql returns the privileges that the user does *not* have, given a
list of privs that are required. It returns the correct results using
Sql*plus but no results using jdbc (i.e. result.next()=false). No
exceptions are thrown, unless I ignore the fact that resultset
returned false and try to do result.getString(1) anyway. Then I get
java.sql.SQLException: Exhausted Resultset
I wondered if it was due to the unusual nature of the query, i.e.
using selects from dual to create a 'fake' table.
select tempPrivs.priv from (
select 'ALTER USER' priv from dual
union select 'CREATE PROCEDURE' priv from dual
union select 'CREATE SYNONYM' priv from dual
union select 'CREATE TABLE' priv from dual ) tempPrivs
where not exists (select null from user_sys_privs
where privilege = tempPrivs.priv);
I am using Windows XP, Oracle 8.1.7.4 database, Oracle JDBC drivers
9.2.0.4 and J2SE 1.4.1.
Anyone have any ideas?
Andy Cole.
Joe Weinstein - 26 Jan 2004 16:49 GMT
> I am trying to run the following sql using
>
[quoted text clipped - 25 lines]
>
> Andy Cole.
Is your code exactly?:
String command = "select tempPrivs.priv from ( "
+ " select 'ALTER USER' priv from dual "
+ " union select 'CREATE PROCEDURE' priv from dual "
+ " union select 'CREATE SYNONYM' priv from dual "
+ " union select 'CREATE TABLE' priv from dual ) tempPrivs "
+ " where not exists (select null from user_sys_privs "
+ " where privilege = tempPrivs.priv) ";
Statement s = connection.createStatement();
ResultSet result = s.executeQuery(command);
while (result.next()) { ... }
Joe Weinstein at BEA
Andy - 27 Jan 2004 11:47 GMT
Sorry everyone, it was user error. Can't think where my brain was
yesterday but have now sorted it :-)