3

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 "

Rick
  • 91
  • 8

1 Answers1

3

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.

Community
  • 1
  • 1
TheMP
  • 8,257
  • 9
  • 44
  • 73
  • More detailed article: http://alvinalexander.com/android/sqlite-dump-backup-database-file-how – liosedhel May 20 '14 at 18:00
  • So it's not possible to export using Java? If I could run that (.dump) somewhere in my code after the user pressed a button that would be great. – Rick May 21 '14 at 07:28
  • I think it is not possible. However you can invoke this command in java using java.lang.Runtime. – liosedhel May 21 '14 at 11:36