Java JDBC/SQLite: Export tables to sql statements

2019-07-22 00:57发布

问题:

I'm currently working with a SQLite database in java. But I would like to export all the tables and their data to SQL statements.

I've tried using:

"SELECT * FROM TABLENAMES INTO OUTFILE '...'

But that gives me an error: " near "INTO": syntax error "

回答1:

To achieve that, you can use outer software, such as SQLDeveloper or SQLAdministrator. IntelliJ in Ultimate edition also supports exporting table data.

UPDATE:

If you want to export it using only sql you can use

sqlite3 db .dump

See also this info if you want to export only selected tables.