12

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.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Steven
  • 123
  • 1
  • 1
  • 7

4 Answers4

5

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.
Alvin Thompson
  • 5,388
  • 3
  • 26
  • 39
3

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'.

Bryan Pendleton
  • 16,128
  • 3
  • 32
  • 56
3

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

user2891462
  • 3,033
  • 2
  • 32
  • 60
1

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.

CodeToLife
  • 3,672
  • 2
  • 41
  • 29