db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nm56 <nmeade5...@verizon.net>
Subject Re: Read Server Created DB with Embedded Driver
Date Wed, 19 May 2010 20:38:12 GMT

On my classpath I have everything that my application needs and 4 derby Jars
- derby, derbyclient, derbynet and derby tools. I also have a jar that holds
my db that isn't on the level of everything else in the app jar i.e.
"lib/derby.jar ../app.jar" This is my URL:

jdbc:derby:classpath:/appdb;bootPassword=password 

I've tried it both the the preceding slash on the dbname and without.

I've also tried it using
jdbc:derby:jar:(C:/localpath/appdb.jar)appdb;bootPassword=password

All of these tries give me teh same result - it chops off jdbc:derby and
takes everything after that until the semi-colon to be the database name.



Kristian Waagan-4 wrote:
> 
> On 19.05.10 19:20, nm56 wrote:
>>
>> Thanks but it's still not working. Every time I either try to do the
>> :classpath or :jar options to connect to my db within a jar file it says
>> 'jar:db_name' or 'classpath:db_name' not found.
>>
>> Is this a bug? Do I need to specify this part as a parameter to
>> databaseName
>> instead of this subprotocol?
> 
> I don't think you have to use the databaseName parameter.
> 
> Maybe you get more help if you describe what you have on your classpath 
> and post the connection URL?
> Also, have you consulted the manuals on how to specify the database when 
> using the jar or classpath subsubprotocol?
> 
> 
> Regards,
> -- 
> Kristian
> 
>>
>>
>>
>> Kristian Waagan-4 wrote:
>>>
>>> On 19.05.10 16:49, nm56 wrote:
>>>> Hi, a little background:
>>>>
>>>> I'm zipping up a Java App along with a derby db that I created using
>>>> the
>>>> network server.
>>>>
>>>> Is it possible to read a locally or transplanted derby db that was
>>>> created
>>>> and saved using the network driver by using the embedded driver to read
>>>> it
>>>> or are they just incompatible as I suspect?
>>>>
>>>
>>> Hi,
>>>
>>> You can read a database created by the network server with the embedded
>>> driver.
>>> As a matter of fact, the Derby network server is using the embedded
>>> driver internally to access the database.
>>>
>>>> If they are incompatible, how can I tell the server the location of the
>>>> database I want to access if it is outside of DERBY_HOME?
>>>>
>>>
>>> I suppose you meant compatible here?
>>> You have a few options, but assuming you want read/write access, you can
>>> specify the absolute or relative path to the database in the connection
>>> URL.
>>> For instance:
>>>    'jdbc:derby:/my/db/dir/db'
>>>    'jdbc:derby:../dbs/mydb'
>>>
>>> If you only need read access, you can access the database from a JAR/zip
>>> or from the classpath. See the manual(s) for details.
>>> If you need throw-away databases, you can either create/copy a new
>>> database from a backup/master, or you can boot a backup/master into
>>> memory (non-persisted db) using the in-memory protocol. You can do these
>>> things either by copying the database directory using you OS tools (cp
>>> or copy), or you can use the createFrom/restoreFrom connection
>>> attributes.
>>>
>>>
>>> Hope this helps,
>>> --
>>> Kristian
>>>
>>>> Thanks for any help...
>>>>
>>>
>>>
>>>
>>
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Read-Server-Created-DB-with-Embedded-Driver-tp28609335p28613846.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message