caw
caw

Reputation: 31497

Open Derby/JDBC database in file system

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

Is there any 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 very much in advance!

Upvotes: 4

Views: 7153

Answers (2)

havexz
havexz

Reputation: 9590

You should install Derby if have not already. Derby comes with a command line tool ij. Use this tool to dump the tables as sql queries or csv files. You can uses these to import to sqlite.

First choose the output format using

And then use these SQLs on the command line of IJ to export to file.

Find details about ij here after clicking this link...click Running IJ.

Some basic IJ tool example

For exporting data out of Derby

Snippet for running IJ

`Method When to Use Command Run ij as a standalone command. Use this method if you are relatively new to the Java programming language and new to Derby. Follow the steps in Setting the environment variables before you run the ij tool using this method. To run the ij script from the command line, use: ij You must add the DERBY_HOME/bin directory to your PATH environment variable before you can run the ij tool.

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

Example of tool CLI:

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)>

Upvotes: 5

brettw
brettw

Reputation: 11124

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

Upvotes: 2

Related Questions