On Thu, 2003-01-23 at 05:24, Peter Willadt wrote:
> Hello,
> On Mittwoch, 22. Januar 2003 16:28, Laurent Vaills wrote:
> > Hi.
> >
> > I set up a database with 2 users created like this with dbmcli :
> > sql_execute CREATE USER admin PASSWORD admin RESOURCE
> > sql_execute CREATE USER toto PASSWORD toto STANDARD
> >
> > When I execute the attached java program it fails !
> > The user toto cannot see the table TestGrant created by the user admin.
> >
> > The GRANT statement does not seem to be executed (returns -1).
> > I tested to execute the GRANT statement with dbmcli and everything
> > works.
> >
> >   connection = DriverManager.getConnection(url, "admin", "admin");
> >   select.executeUpdate("CREATE TABLE TestGrant (ID INT NOT NULL)");
> >   int count = select.executeUpdate("GRANT ALL ON TestGrant TO PUBLIC");
> [...]
> >       connection = DriverManager.getConnection(url, "toto", "toto");
> >        rset = select.executeQuery("SELECT ID FROM TestGrant");
> 
> I am not quite sure but it looks to me as if you had missed to qualify the 
> table name by the schema. You should propably ask for 
> SELECT ID from admin.testgrant
> or create a public synonym for your table.
> 
> Peter Willadt

Thanks for tip Peter ! It works.
But if create the table with the user dba and try to acces the data with
the user admin without specifying the schema and it works !

In the Javadoc it's written that the method executeUpdate should return
"either the row count for INSERT, UPDATE  or DELETE statements, or 0 for
SQL statements that return nothing"
So as it returns -1 in my program, I assume that this is not normal,
isn't it ?

Laurent

> 
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to