Open Derby / JDBC Database on File System

I have a database that is used in Java with Derby / JDBC. In the file system, I can see the following entries:

  • journal (folder)
    • log.ctrl (file)
    • log142.dat (file)
    • logmirror.ctrl (file)
  • seg0 (folder)
    • c ... (60 files with 8-7000 kB)
  • tmp (folder)
  • db.lck (file)
  • service.properties (file)

Is there a chance to open this database? I would like to convert this database to SQLite, so I need to see the structure at least.

Thank you in advance!

+4
source share
2 answers

You must install Derby if you haven’t already. Derby comes with the ij command line tool. Use this tool to upload tables as sql queries or csv files. You can use them to import into sqlite.

First select the output format using

And then use these SQLs at the IJ command prompt to export to a file.

Read more about ij here after clicking this link ... click "Launch IJ".

An example of the main IJ tool

To export data from Derby

Fragment for launching IJ

`How to use the command Run ij as a separate command. Use this method if you are relatively new to the Java programming language and new to Derby. Follow the instructions in the "Setting Environment Variables" section before running the ij tool using this method. To run the ij script from the command line, use: I.Ya. You must add the DERBY_HOME / bin directory to the PATH environment variable before you can run the ij tool.

The ij script sets the appropriate environment variables, including CLASSPATH, and runs the ij tool.

CLI tool example:

ij> connect 'sample' as sample1;

ij> connect 'newDB; create = true 'as newDB;

ij (NEWDB)> show connections;

SAMPLE1 - jdbc: derby: sample

NEWDB * - jdbc: derby: newDB; create = true

  • = current connection

IJ (NEWDB)>

+5
source

I recommend looking at SQuirrel SQL as it can copy data from one database to another. Take a look at the plugins page for the DBCopy plugin. Using SQuirreL, you can also right-click on a table in the object view and generate a CREATE TABLE statement for a structure, etc. Handy

+2
source

Source: https://habr.com/ru/post/1399601/


All Articles