You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Geetha Attili <ge...@oracle.com> on 2013/06/21 01:08:17 UTC

Cannot access DB on Classpath

Hi ,
I am trying to connect to a JavaDB Database  on Classpath , I tried 
various things as given in the doc, but I feel the behaviour is very 
inconsistent or may be I am doing some silly mistake.

In a Command prompt
 > cd D:\DerbyDemo
 >ij
ij version 10.8
//created a sample database jdb_classpath
ij>connect 'jdbc:derby:jdb_classpath;create=true;';
//created a sample Table
ij>create table mytable(id numeric);
//Disconnected from the jdb_classpath database
ij>disconnect;


I have then Set the Classpath to include D:\DerbyDemo ;
Opened a new command prompt
 >ij
  tried connecting to the jdb_classpath using the following syntax
ij>connect 'jdbc:derby:/jdb_classpath';

ERROR XJ004: Database '/jdb_classpath' not found.

As per the Doc 
<http://docs.oracle.com/javadb/10.8.1.2/devguide/rdevdvlp22102.html>  as 
in example, this should have worked
"

  * /jdbc:derby:/myDB/

    Access /myDB/ (which is directly in a directory in the classpath) as
    a read-only database.

    "


ij>connect 'jdbc:derby:classpath:jdb_classpath';
Connection successful. there is no other database with the same name in 
the classpath .
Do I have to use the classpath  subprotocol always?

Many Thanks in Advance,
Geetha

Re: Cannot access DB on Classpath

Posted by Rick Hillegas <ri...@oracle.com>.
On 6/21/13 5:49 AM, Geetha Attili wrote:
> Thanks very much Rick , that explains the failing case.
> I am using the 10.8 jdbc driver so wondered if its supposed to work .
Hi Geetha,

I don't recall any recent changes to the jdbc driver in this area. The 
documentation was simply wrong.

Thanks,
-Rick
>
> -Geetha
> On 21/06/2013 13:44, Rick Hillegas wrote:
>> On 6/20/13 4:08 PM, Geetha Attili wrote:
>>> Hi ,
>>> I am trying to connect to a JavaDB Database  on Classpath , I tried 
>>> various things as given in the doc, but I feel the behaviour is very 
>>> inconsistent or may be I am doing some silly mistake.
>>>
>>> In a Command prompt
>>> > cd D:\DerbyDemo
>>> >ij
>>> ij version 10.8
>>> //created a sample database jdb_classpath
>>> ij>connect 'jdbc:derby:jdb_classpath;create=true;';
>>> //created a sample Table
>>> ij>create table mytable(id numeric);
>>> //Disconnected from the jdb_classpath database
>>> ij>disconnect;
>>>
>>>
>>> I have then Set the Classpath to include D:\DerbyDemo ;
>>> Opened a new command prompt
>>> >ij
>>>  tried connecting to the jdb_classpath using the following syntax
>>> ij>connect 'jdbc:derby:/jdb_classpath';
>>>
>>> ERROR XJ004: Database '/jdb_classpath' not found.
>>>
>>> As per the Doc 
>>> <http://docs.oracle.com/javadb/10.8.1.2/devguide/rdevdvlp22102.html>  as 
>>> in example, this should have worked
>>> "
>>>
>>>     * /jdbc:derby:/myDB/
>>>
>>>       Access /myDB/ (which is directly in a directory in the
>>>       classpath) as a read-only database.
>>>
>>>       "
>>>
>>>
>>> ij>connect 'jdbc:derby:classpath:jdb_classpath';
>>> Connection successful. there is no other database with the same name 
>>> in the classpath .
>>> Do I have to use the classpath  subprotocol always?
>>>
>>> Many Thanks in Advance,
>>> Geetha
>> Hi Geetha,
>>
>> You are reading the 10.8 docs. The documentation in this area was 
>> cleaned up in later releases. The failing example was removed from 
>> that topic in the Developer's Guide. Please consult the corresponding 
>> topic in the 10.10 version of the Developer's Guide: 
>> http://db.apache.org/derby/docs/10.10/devguide/index.html
>>
>> Hope this helps,
>> -Rick
>


Re: Cannot access DB on Classpath

Posted by Geetha Attili <ge...@oracle.com>.
Thanks very much Rick , that explains the failing case.
I am using the 10.8 jdbc driver so wondered if its supposed to work .

-Geetha
On 21/06/2013 13:44, Rick Hillegas wrote:
> On 6/20/13 4:08 PM, Geetha Attili wrote:
>> Hi ,
>> I am trying to connect to a JavaDB Database  on Classpath , I tried 
>> various things as given in the doc, but I feel the behaviour is very 
>> inconsistent or may be I am doing some silly mistake.
>>
>> In a Command prompt
>> > cd D:\DerbyDemo
>> >ij
>> ij version 10.8
>> //created a sample database jdb_classpath
>> ij>connect 'jdbc:derby:jdb_classpath;create=true;';
>> //created a sample Table
>> ij>create table mytable(id numeric);
>> //Disconnected from the jdb_classpath database
>> ij>disconnect;
>>
>>
>> I have then Set the Classpath to include D:\DerbyDemo ;
>> Opened a new command prompt
>> >ij
>>  tried connecting to the jdb_classpath using the following syntax
>> ij>connect 'jdbc:derby:/jdb_classpath';
>>
>> ERROR XJ004: Database '/jdb_classpath' not found.
>>
>> As per the Doc 
>> <http://docs.oracle.com/javadb/10.8.1.2/devguide/rdevdvlp22102.html> 
>> as in example, this should have worked
>> "
>>
>>     * /jdbc:derby:/myDB/
>>
>>       Access /myDB/ (which is directly in a directory in the
>>       classpath) as a read-only database.
>>
>>       "
>>
>>
>> ij>connect 'jdbc:derby:classpath:jdb_classpath';
>> Connection successful. there is no other database with the same name 
>> in the classpath .
>> Do I have to use the classpath  subprotocol always?
>>
>> Many Thanks in Advance,
>> Geetha
> Hi Geetha,
>
> You are reading the 10.8 docs. The documentation in this area was 
> cleaned up in later releases. The failing example was removed from 
> that topic in the Developer's Guide. Please consult the corresponding 
> topic in the 10.10 version of the Developer's Guide: 
> http://db.apache.org/derby/docs/10.10/devguide/index.html
>
> Hope this helps,
> -Rick


Re: Cannot access DB on Classpath

Posted by Rick Hillegas <ri...@oracle.com>.
On 6/20/13 4:08 PM, Geetha Attili wrote:
> Hi ,
> I am trying to connect to a JavaDB Database  on Classpath , I tried 
> various things as given in the doc, but I feel the behaviour is very 
> inconsistent or may be I am doing some silly mistake.
>
> In a Command prompt
> > cd D:\DerbyDemo
> >ij
> ij version 10.8
> //created a sample database jdb_classpath
> ij>connect 'jdbc:derby:jdb_classpath;create=true;';
> //created a sample Table
> ij>create table mytable(id numeric);
> //Disconnected from the jdb_classpath database
> ij>disconnect;
>
>
> I have then Set the Classpath to include D:\DerbyDemo ;
> Opened a new command prompt
> >ij
>  tried connecting to the jdb_classpath using the following syntax
> ij>connect 'jdbc:derby:/jdb_classpath';
>
> ERROR XJ004: Database '/jdb_classpath' not found.
>
> As per the Doc 
> <http://docs.oracle.com/javadb/10.8.1.2/devguide/rdevdvlp22102.html>  
> as in example, this should have worked
> "
>
>     * /jdbc:derby:/myDB/
>
>       Access /myDB/ (which is directly in a directory in the
>       classpath) as a read-only database.
>
>       "
>
>
> ij>connect 'jdbc:derby:classpath:jdb_classpath';
> Connection successful. there is no other database with the same name 
> in the classpath .
> Do I have to use the classpath  subprotocol always?
>
> Many Thanks in Advance,
> Geetha
Hi Geetha,

You are reading the 10.8 docs. The documentation in this area was 
cleaned up in later releases. The failing example was removed from that 
topic in the Developer's Guide. Please consult the corresponding topic 
in the 10.10 version of the Developer's Guide: 
http://db.apache.org/derby/docs/10.10/devguide/index.html

Hope this helps,
-Rick