Solved

Saving embedded Derby DB to a file.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what is the difference between "sudo su" and "su - root" 6 102
backtracking recursion  code 19 53
maven project error 5 48
diffSum example 4 21
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 …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

914 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now