Solved

Saving embedded Derby DB to a file.

Posted on 2006-11-23
1
309 Views
Last Modified: 2010-08-05
To create a derby db and get a connection I do:

        String driver = "org.apache.derby.jdbc.EmbeddedDriver";
        Class.forName(driver).newInstance();
        Properties props = new Properties();
       
        // to create a new database
        props.put("create","true");
       
        return DriverManager.getConnection(dbUri, props);

I then do normal JDBC operations on that connection to create tables and insert values into those tables.


Then what do I do? How do I tell it to store that data on disk somewhere so that I can open it again later? I assume that the "createFrom" property would be used to reopen an existing derby db. But, I don't see a property that specifies how to save the data there in the first place.
0
Comment
Question by:HappyEngineer
1 Comment
 
LVL 14

Accepted Solution

by:
hoomanv earned 500 total points
ID: 18006161
The connection url to create an embedded db is like
    jdbc:derby:directory:C:\name;create=true
And after the db is created you can omit the "create=true" option
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
rhino JavaScript import, load 25 84
replace a word with other 1 44
Should localization be done inside spring controller 5 26
more than one jdk and one jre 1 41
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question