1

Situation is we are generating a sqlite database as an output.

I want to see if said database equals an expected database file.

So far I have been using sqlite3 to generate dumps and then comparing the files, as suggested in this question: How to compare two sqlite databases on linux.

This works well for our purposes, however I've noticed that I'm using a sqlite3 executable for linux. I am using the following code to create dumps:

// call sqlite3 .dump
Process p = Runtime.getRuntime().exec(executeCommand);

This causes the tests to fail in a Windows environment:

java.io.IOException: Cannot run program "C:\[...]": CreateProcess error=193, 
    %1 is not a valid Win32 application
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at java.lang.Runtime.exec(Runtime.java:617)

I think I could simply write a bunch of queries, or include all sqlite3 executables and just check for the OS and hide this behind an interface, but I thought I'd ask first to see if anyone had a simpler solution, or even a different methodology that avoids the problem entirely.

5
  • 2
    "I've noticed that sqlite3 is platform dependent." How? What is the difference between platforms? Commented Jul 3, 2014 at 14:40
  • Edited question to clarify. Commented Jul 3, 2014 at 14:44
  • stackoverflow.com/search?q=schemacrawler+sqlite Commented Jul 3, 2014 at 14:45
  • If the databases are identical the dumps should be identical. Does this boil down to a question about line endings? Commented Jul 3, 2014 at 14:57
  • What's different, no doubt, is the environments between the two systems. Different directory structure, different command syntax, etc. Commented Jul 3, 2014 at 14:58

1 Answer 1

0

The way I understand this is that you want to make sure that the database schema (that is, tables, columns and so on) and the data itself in your SQLite databases on different systems are the same. You should use one of many database comparison tools.

SchemaCrawler for SQLite is one such - a free, cross-platform tool designed for performing database schema and data diffs, using a human readable plain-text format.

Sualeh Fatehi, SchemaCrawler

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.