[ 
https://issues.apache.org/jira/browse/DERBY-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702018#action_12702018
 ] 

Rick Hillegas commented on DERBY-4172:
--------------------------------------

How does the following user-visible behavior sound? I think this would be easy 
to explain and the backward incompatibilities would be very rare (probably 
non-existent) and easy to workaround:

*  We could distinguish between logical and physical database names:
          o A logical database name consists of the subprotocol plus the 
database path. That is, each subprotocol defines a separate namespace of 
databases.
          o The physical database is an actual database which is opened. The 
same physical database may have more than one logical name. 

* We would prevent a physical database from being opened under two different 
logical names simultaneously. Once a database has been opened under a logical 
name, other connections to the database must use that original logical name. 
After the database has been closed, it can be re-opened under a different 
logical name. 

> 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.

Reply via email to