You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dag H. Wanvik (JIRA)" <ji...@apache.org> on 2009/04/21 23:16:47 UTC
[jira] Issue Comment Edited: (DERBY-4172) You can open a read-write
connection to a database which was originally opened by another thread
using the classpath subprotocol
[ https://issues.apache.org/jira/browse/DERBY-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12701269#action_12701269 ]
Dag H. Wanvik edited comment on DERBY-4172 at 4/21/09 2:16 PM:
---------------------------------------------------------------
If the file name is simple, Derby handles it (current directory is on classpath here):
ij> connect 'jdbc:derby:classpath:wombat';
ij> insert into t values 1;
ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.
ij> connect 'jdbc:derby:wombat';
ij(CONNECTION1)> insert into t values 1;
ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.
ij(CONNECTION1)>
The second connect uses the normal file based URL. If I used an absolute path Derby fails to match them:
ij(CONNECTION1)> connect 'jdbc:derby:/export/home/dag/java/sb/tests/foo/wombat';
ij(CONNECTION2)> insert into t values 1;
1 row inserted/updated/deleted
although this is the same "wombat":
ij(CONNECTION2)> exit;
dag@T61pOS:~/java/sb/tests/foo$ pwd
/export/home/dag/java/sb/tests/foo
derby.log shows two booted instances, corresponding to connect 1 and 3 above,
was (Author: dagw):
If the file name is simple, Derby handles it (current directory is on classpath here):
ij> connect 'jdbc:derby:classpath:wombat';
ij> insert into t values 1;
ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.
ij> connect 'jdbc:derby:wombat';
ij(CONNECTION1)> insert into t values 1;
ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.
ij(CONNECTION1)>
The second connect uses the normal file based URL. If I used an absolute path is fails to match them:
ij(CONNECTION1)> connect 'jdbc:derby:/export/home/dag/java/sb/tests/foo/wombat';
ij(CONNECTION2)> insert into t values 1;
1 row inserted/updated/deleted
although this is the same "wombat":
ij(CONNECTION2)> exit;
dag@T61pOS:~/java/sb/tests/foo$ pwd
/export/home/dag/java/sb/tests/foo
derby.log shows two booted instances, corresponding to connect 1 and 3 above,
> You can open a read-write connection to a database which was originally opened by another thread using the classpath subprotocol
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4172
> URL: https://issues.apache.org/jira/browse/DERBY-4172
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.6.0.0
> Reporter: Rick Hillegas
>
> The original connection, using the classpath subprotocol, was supposed to open the DATABASE (not the connection) as read-only, according to the Developer's Guide section titled "Database connection examples". However, I am able to write to this database in another connection which opens the database using the default, file-based protocol.
> At a minimum, the documentation is wrong. But the documentation may be trying to impose a consistent, easily described model on the behavior of our subprotocols. It may be that the behavior of our subprotocols cannot be described by a simple set of rules that users can grasp easily.
> To show this problem, I created a database and then moved it into a directory on my classpath (in this case, trunk/classes). Here is a script which shows this behavior:
> connect 'jdbc:derby:classpath:derby10.6' as conn1;
> -- fails because a database which is opened on the classpath is supposed to be marked as read-only
> insert into t( a ) values 1;
> connect 'jdbc:derby:trunk/classes/derby10.6' as conn2;
> -- this succeeds even though the database is supposed to be read-only
> -- according to the Developer's Guide section "Database connection examples"
> insert into t( a ) values 2;
> select * from t;
> delete from t;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.