I have successfully exported the Derby schema using ddlUtils but how do I export table data in derby to insert SQL statements?
Is there any way to convert derby database table rows to SQL insert statements
551 Views Asked by oyers At
2
There are 2 best solutions below
0
On
- Run your SQL request like "select * from schema.table;".
- In the window where the rows are displayed, select them all with keyboard, not "control+A" which has no effect.
- Right-click and in the contextual menu, select "Show SQL Script for INSERT" : a pop-up window in displayed, and you just have to copy the content to a text file.
Note : I use Netbeans 8.2.
If you're willing to use a third-party tool for this, you could use jOOQ
There's a known issue that the above generates the wrong table name in the insert statement. You can fix this by patching the output:
(Disclaimer: I work for the company behind jOOQ)