Steven
Steven

Reputation: 123

Exporting Derby database in Netbeans

I have a project with a derby database in it.

I want to be able to make a backup or export the database so I can give it with the project files to my lecturer.

Upvotes: 12

Views: 27834

Answers (4)

CodeToLife
CodeToLife

Reputation: 4141

For 2017 NetBeans.

Let me suggest how to export sql scripts' file(after connection to db). So that,go to

1. Services -> Data base -> link -> Schema ->tables -> MYDB.

2. Rightclick on MYDB and select 'Browse data'. And then click 'execute sql' first icon/button

3. In the list of rows below rightclick any of them, and choose "Show scenario for Create.." Sometimes output/logs window may overlay that list though. In such case close it please.

4. Copypast(cntrl-c,cntrl-v) instruction from popup window to a prepared by you previously txt file

5. Again click any of bottom list's rows. Select all of them by cntrl-a keys' combination. Rightclick and select "Show scenario for INSERT.."

6. Copy instruction from popup window and past/add them to mentioned above txt file

You are done with sql scripts' file.

Upvotes: 1

Alvin Thompson
Alvin Thompson

Reputation: 5448

By default, the database resides in your home folder under .netbeans-derby (this folder may be hidden under Windows). Copying this folder will work, but your lecturer will have to "register" this copied location with his IDE. To do this:

  • Under Services, open the Databases node.
  • Right-click on Java DB and select properties.
  • In the Database Location field, enter the path to the copied folder.

Upvotes: 5

user2891462
user2891462

Reputation: 3333

Late, but it may be useful for others:

  1. In Netbeans, start a connection to your database.
  2. Right click on it and select 'Execute command'
  3. Write this: CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'YOURTABLE', 'PATHTODUMPFILE', null, null, null)

Remember to write the name of your table and path between simple quotation marks ' '

More information in http://db.apache.org/derby/docs/10.9/adminguide/radminimport91458.html

Upvotes: 3

Bryan Pendleton
Bryan Pendleton

Reputation: 16349

There are lots of ways to backup and/or export data in a Derby database: here's a link to the docs: http://db.apache.org/derby/docs/10.9/adminguide/cadminparttwo.html

In order to make the backup, you have to find the database data on disk. It will all be located in a single folder/directory; that folder/directory is named using the name of your database. So if your database is jdbc:derby:brydb, look for a folder named 'brydb'.

Upvotes: 3

Related Questions