Solved

Saving embedded Derby DB to a file.

Posted on 2006-11-23
1
324 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jsp insert to database example 2 66
Java syntax, or is it Selenium 6 43
What browser will run Java? 7 129
Java pass by reference 3 25
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

730 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