This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Succeeding with AI and have Veljko Krunic on-line!
See this thread for details.
Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Setting Location for database to be used by javadb

 
Greenhorn
Posts: 12
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am stuck figuring out how to set directory location to be used by javadb. Below is the code I using to create database, a test table and few queries - it uses some other class too to find appropriate location of database.


I have used - Line Number 43-44.
But running this shows me the database directory as DBLocation: /home/vikesh/.logbook/db[/b], whereas it creates the database directory named db_log_data in the same directory from where I run this. Is there any other way I can specify location of database. What I am doing wrong?

Here is the output of above:

DBLocation: /home/vikesh/.logbook/db
Got A Connection: org.apache.derby.impl.jdbc.EmbedConnection40@26977856 (XID = 152), (SESSIONID = 1), (DATABASE = db_log_data), (DRDAID = null)
Got: 1, hmmmm


Thanks for helping.
 
Ranch Hand
Posts: 423
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

read this: http://db.apache.org/derby/docs/10.8/ref/rrefproper32066.html
and note that derby.system.hom is a static property - if Derby is running, you must reboot it for changes to take effect.

But an easier method is just to set directory locaction in the connection URL, like this:

In this example, Derby will create dbmane subirectory in /home/korkodrilko/test/.

On windows you can use drive letter plus colon in the path, and probably (don't remember) both slashes and backshlashes:
 
Yaki Kumar
Greenhorn
Posts: 12
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, I got it sorted. It seems the problem in my case was that the directory supposed to contain db files was already present and not created by execution of following.
.
Once I did not have the particular directory in place before above code executed, it all got fine.

Thanks a lot!
 
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic