db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5612) Puzzling documentation about the URL to a database on the classpath
Date Tue, 14 Feb 2012 09:51:59 GMT

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

Knut Anders Hatlen commented on DERBY-5612:

The change was introduced by this commit:

r240111 | djd | 2005-08-25 20:02:57 +0200 (Thu, 25 Aug 2005) | 9 lines

DERBY-540 Do not prepend database name for classpath databases with leading slash.This causes
databases to be not found when in jar files on the database. Correct the lookup of resources
in the class path storage factory to not use the methods that prepend the current class name,
instead use methods from ClassLoader directly. The leading slash was incorrectly added to
the automatic package prepending performed by Class.getResource.
Removed code that tried to optimise not using the thread context class loader, simply have
fixed lookup for resources of thread context class loader followed by class loader for Derby/system
Add lang/dbjar.sql to test databases within a jar and within a jar on the classpath and class
loading from such databases.

> Puzzling documentation about the URL to a database on the classpath
> -------------------------------------------------------------------
>                 Key: DERBY-5612
>                 URL: https://issues.apache.org/jira/browse/DERBY-5612
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions:
>            Reporter: Rick Hillegas
> The "Accessing databases from the classpath" section of the Derby Developer's Guide says
that you can access a database on the classpath by putting a forward slash in front of the
database name (and then adding other path legs as needed). I don't find that it works this
way. I ran the following experiment:
> 1) I put a database called nast in the testRun/extin subdirectory of the current directory.
> 2) Then I put testRun/extin on the classpath.
> 3) Then I tried connecting to the database with various URLs.
> The following URLs could not find the database:
> connect 'jdbc:derby:/nast;user=KIWI;password=KIWI_password';
> connect 'jdbc:derby:nast;user=KIWI;password=KIWI_password';
> connect 'jdbc:derby:classpath:/nast;user=KIWI;password=KIWI_password';
> But the following URL found the database:
> connect 'jdbc:derby:classpath:nast;user=KIWI;password=KIWI_password';
> This is not what I expected from the documentation in the Developer's Guide.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message