[
https://issues.apache.org/jira/browse/DERBY-4171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kristian Waagan updated DERBY-4171:
-----------------------------------
Attachment: derby-4171-1b-fix.diff
Attached patch 1b, which will cause null to be returned if no subsubprotocol is
specified and the storage factory isn't the default one.
This is what the JavaDoc for PersistentService.getCanonicalServiceName says:
/**
Convert a service name into its canonical form. Returns null if
the name
cannot be converted into a canonical form.
@exception No canonical name, name probably invalid
*/
Returning null is in agreement with the following existing code
(StorageFactoryService.getCanonicalServiceName):
if( colon > 1) // Subsubprotocols must be at least 2 characters long
{
if( ! name.startsWith( protocolLeadIn))
return null; // It is not our database
name = name.substring( colon + 1);
}
Since there's an ongoing discussion about database namespaces and
subsubprotocols, I'll hold off the commit for a while.
> Connections to on-disk db go to in-memory db if in-memory db with same name
> is booted
> -------------------------------------------------------------------------------------
>
> Key: DERBY-4171
> URL: https://issues.apache.org/jira/browse/DERBY-4171
> Project: Derby
> Issue Type: Bug
> Components: Store
> Affects Versions: 10.5.1.1, 10.6.0.0
> Reporter: Knut Anders Hatlen
> Assignee: Kristian Waagan
> Attachments: derby-4171-1a-fix.diff, derby-4171-1b-fix.diff
>
>
> When an in-memory database has been booted, subsequent attempts to connect to
> an ordinary (on-disk) database with the same name as the in-memory database
> will connect to the in-memory db.
> ij version 10.5
> ij> connect 'jdbc:derby:memory:MyDB;create=true'; -- with subprotocol memory
> ij> create table t (x varchar(30));
> 0 rows inserted/updated/deleted
> ij> insert into t values 'This is the in-memory backend';
> 1 row inserted/updated/deleted
> ij> connect 'jdbc:derby:MyDB;create=true'; --without subprotocol memory,
> should create disk db
> WARNING 01J01: Database 'MyDB' not created, connection made to existing
> database instead.
> ij(CONNECTION1)> select * from t;
> X
> ------------------------------
> This is the in-memory backend
> 1 row selected
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.