Hi Yip,
I am a newbee to Derby and I was trying to reproduce the error by
following the steps you mentioned. Before I could reproduce the problem,
I encountered another error i.e.:
ij version 10.2
ij> connect 'jdbc:derby:test;create=true' user 'user1' as user1;
ij> CALL
SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.sqlAuthorization','true');
0 rows inserted/updated/deleted
ij> connect 'jdbc:derby:test;create=true' user 'user2' as user2;
WARNING 01J01: Database 'test' not created, connection made to existing
database instead.
ij(USER2)> connect 'jdbc:derby:test;create=true' user 'user3' as user3;
WARNING 01J01: Database 'test' not created, connection made to existing
database instead.
ij(USER3)> set connection user1;
ij(USER1)> create table tbl1(c varchar(1));
0 rows inserted/updated/deleted
ij(USER1)> insert into tbl1 values 'a', 'b', 'c';
3 rows inserted/updated/deleted
ij(USER1)> autocommit off;
ij(USER1)> grant select on tbl1 to user3;
ERROR 42Z60: GRANT not allowed unless database property
derby.database.sqlAuthorization has value 'TRUE'.
Yip Ng (JIRA) wrote:
Can you please provide some input for how to set the property
"derby.database.sqlAuthorization" to true.
Thanks in advance,
Saurabh
Executing grant statement within a transaction leads to a NPE later when the db
owner attempts to update a table
----------------------------------------------------------------------------------------------------------------
Key: DERBY-1724
URL: http://issues.apache.org/jira/browse/DERBY-1724
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.2.1.0
Environment: Sun JDK 1.4.2
Reporter: Yip Ng
Executing grant within a transaction leads to a NPE later when the db owner
attempts to update a table. i.e.:
ij version 10.2
ij> connect 'test;create=true' user 'user1' as user1;
WARNING 01J14: SQL authorization is being used without first enabling
authentication.
ij> connect 'test;create=true' user 'user2' as user2;
WARNING 01J01: Database 'test' not created, connection made to existing
database instead.
WARNING 01J14: SQL authorization is being used without first enabling
authentication.
ij(USER2)> connect 'test;create=true' user 'user3' as user3;
WARNING 01J01: Database 'test' not created, connection made to existing
database instead.
WARNING 01J14: SQL authorization is being used without first enabling
authentication.
ij(USER3)> set connection user1;
ij(USER1)> create table t1001 (c varchar(1));
0 rows inserted/updated/deleted
ij(USER1)> insert into t1001 values 'a', 'b', 'c';
3 rows inserted/updated/deleted
ij(USER1)> autocommit off;
ij(USER1)> grant select on t1001 to user3;
0 rows inserted/updated/deleted
ij(USER1)> set connection user2;
ij(USER2)> create table ttt1 (i int);
0 rows inserted/updated/deleted
ij(USER2)> insert into ttt1 values 1;
1 row inserted/updated/deleted
ij(USER2)> set connection user1;
ij(USER1)> select * from user2.ttt1;
I
-----------
1
1 row selected
ij(USER1)> insert into user2.ttt1 values 2;
1 row inserted/updated/deleted
ij(USER1)> update user2.ttt1 set i = 888;
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
ij(USER1)> commit;
ij(USER1)>
derby.log:
----------------------------------------------------------------
2006-08-18 09:08:42.234 GMT:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.0
beta - (430903): instance c013800d-010d-208a-11fd-000000146bf0
on database directory C:\work3\derby\tests\derby-10.2.1.0\lib\test
Database Class Loader started - derby.database.classpath=''
2006-08-18 09:08:43.843 GMT Thread[main,5,main] (XID = 129), (SESSIONID = 0),
(DATABASE = test), (DRDAID = null), Cleanup action starting
2006-08-18 09:08:43.843 GMT Thread[main,5,main] (XID = 129), (SESSIONID = 0),
(DATABASE = test), (DRDAID = null), Failed Statement is: update user2.ttt1 set
i = 888
java.lang.NullPointerException
at
org.apache.derby.impl.sql.compile.CompilerContextImpl.addRequiredColumnPriv(Unknown
Source)
at
org.apache.derby.impl.sql.compile.ResultColumn.bindResultColumnByName(Unknown
Source)
at
org.apache.derby.impl.sql.compile.ResultColumnList.bindResultColumnsByName(Unknown
Source)
at
org.apache.derby.impl.sql.compile.ResultSetNode.bindResultColumns(Unknown
Source)
at
org.apache.derby.impl.sql.compile.SelectNode.bindResultColumns(Unknown Source)
at org.apache.derby.impl.sql.compile.UpdateNode.bind(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
at org.apache.derby.tools.ij.main(Unknown Source)
Cleanup action completed
2006-08-18 09:08:43.875 GMT:
Shutting down instance c013800d-010d-208a-11fd-000000146bf0
----------------------------------------------------------------
sysinfo:
------------------ Java Information ------------------
Java Version: 1.4.2_12
Java Vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\j2re1.4.2_12
Java classpath: derby.jar;derbytools.jar
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user name: Yip
Java user home: C:\Documents and Settings\Yip
Java user dir: C:\work3\derby\tests\derby-10.2.1.0\lib
java.specification.name: Java Platform API Specification
java.specification.version: 1.4
--------- Derby Information --------
JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
[C:\work3\derby\tests\derby-10.2.1.0\lib\derby.jar] 10.2.1.0 beta - (430903)
[C:\work3\derby\tests\derby-10.2.1.0\lib\derbytools.jar] 10.2.1.0 beta -
(430903)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [de_DE]
version: 10.2.1.0 - (430903)
Found support for locale: [es]
version: 10.2.1.0 - (430903)
Found support for locale: [fr]
version: 10.2.1.0 - (430903)
Found support for locale: [it]
version: 10.2.1.0 - (430903)
Found support for locale: [ja_JP]
version: 10.2.1.0 - (430903)
Found support for locale: [ko_KR]
version: 10.2.1.0 - (430903)
Found support for locale: [pt_BR]
version: 10.2.1.0 - (430903)
Found support for locale: [zh_CN]
version: 10.2.1.0 - (430903)
Found support for locale: [zh_TW]
version: 10.2.1.0 - (430903)
------------------------------------------------------