You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Carol Gloyd <cg...@tamzen.com> on 2006/05/25 15:10:00 UTC

Updating Embedded Derby Db

Hi,

 

I'm fairly new to Derby and am wondering if there is a way to update an
embedded database programatically? By update, I mean adding new tables and
adding columns to one or two of the existing tables.

 

Several months ago I wrote a stand-alone pricing/ordering application which
was distributed on CD.  The client recently requested some changes which
involve the schema changes mentioned above.  The app will be redistributed
on CD once the changes are complete.

 

The problem: The updated database I will provide contains no data.  Customer
A receives the updated application, but already has data in her current
database, and cannot just overwrite with the "empty" updated database.  I
need to create what amounts to a "1-click" method for the customer to update
the database without losing any of the current data.  Is there existing code
or other information that could help me with this?

 

Hope this makes sense!

 

Thanks,

Carol


Re: Updating Embedded Derby Db

Posted by Vic Ricker <vi...@ricker.us>.
Would it be easier to just issue 'alter' and 'create table' commands on
the existing database instead of sending a new one?  For example, "Alter
table foo add column bar ..." and 'create table new_table_name ( ...'.

Carol Gloyd wrote:
>
> Hi,
>
>  
>
> I'm fairly new to Derby and am wondering if there is a way to update
> an embedded database programatically? By update, I mean adding new
> tables and adding columns to one or two of the existing tables.
>
>  
>
> Several months ago I wrote a stand-alone pricing/ordering application
> which was distributed on CD.  The client recently requested some
> changes which involve the schema changes mentioned above.  The app
> will be redistributed on CD once the changes are complete.
>
>  
>
> The problem: The updated database I will provide contains no data. 
> Customer A receives the updated application, but already has data in
> her current database, and cannot just overwrite with the "empty"
> updated database.  I need to create what amounts to a "1-click" method
> for the customer to update the database without losing any of the
> current data.  Is there existing code or other information that could
> help me with this?
>
>  
>
> Hope this makes sense!
>
>  
>
> Thanks,
>
> Carol
>

-- 
Vic Ricker
http://www.ricker.us/


Re: Updating Embedded Derby Db

Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Carol Gloyd wrote:
> Hi,
> 
> I'm fairly new to Derby and am wondering if there is a way to update an
> embedded database programatically? By update, I mean adding new tables and
> adding columns to one or two of the existing tables.

<snip>

The Derby distribution has examples that might help you. Here's a good
starting point in the binary distribution:

db-derby-10.1.2.1-bin/demo/simple/SimpleApp.java

It shows how to programmatically create, insert into, and drop tables.

I hope this helps -- and, if it doesn't,  feel free to post more questions.

regards,

 -jean