Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8050585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:07:09+00:00 2026-06-05T07:07:09+00:00

I’m developing from Mac OS X a java application that uses a SQLite database

  • 0

I’m developing from Mac OS X a java application that uses a SQLite database using JDBC driver.

The code works perfectly fine on the mac, but I can’t use batch inserts using PreparedStatements on my Windows box.

EDIT: this also doesn’t work with simple Statements that contains a single INSERT INTO instructions (CREATE TABLE works fine).

My code is basically:

Table creation:

    final String sql = "CREATE VIRTUAL TABLE " + TABLE_NAME + " USING fts3("
            + KEY_NOM + ", "
            + KEY_PRENOM + ", "
            + KEY_ADRESSE + ", "
            + KEY_ADRESSE2 + ", "
            + KEY_ADRESSE3 + ");";

    try {
        final Statement s = mConnection.createStatement();
        s.execute(sql);
    } catch (final SQLException e) {
        L.e("Unable to create table: "+sql+"! "+e);
    }

PreparedStatement creation:

    String sql =
            "INSERT INTO "+TABLE_NAME
                    +" ("
                    + KEY_NOM + ", "
                    + KEY_PRENOM + ", "
                    + KEY_ADRESSE + ", "
                    + KEY_ADRESSE2 + ", "
                    + KEY_ADRESSE3 + ") "
                    + " VALUES (?, ?, ?, ?, ?)";

    mConnection.setAutoCommit(false);
    final PreparedStatement prep = mConnection.prepareStatement(sql);

Then there is a loop that parses a CSV file, and at each line the following code is called:

        int i = 1;
        prep.setString(i++, ""+lawyer.nom);
        prep.setString(i++, ""+lawyer.prenom);
        prep.setString(i++, ""+lawyer.adresse);
        prep.setString(i++, ""+lawyer.adresse2);
        prep.setString(i++, ""+lawyer.adresse3);
        prep.addBatch();

When the parsing of the CSV file is over, the following is executed:

        final int[] res = prep.executeBatch();
        mConnection.setAutoCommit(true);
        for (int r: res) {
            if (r != 1) {
                L.e("Error adding entry!");
            }
        }

When I call mConnection.setAutoCommit(true);, the INSERTs statements are executed when it raises the following exception:

java.sql.SQLException: SQL logic error or missing database
at org.sqlite.DB.throwex(DB.java:288)
at org.sqlite.DB.exec(DB.java:68)
at org.sqlite.Conn.setAutoCommit(Conn.java:166)

Tested environments:

  • MacBookAir – Mac OS 10.6 – x64 – Java 1.6.31 – works fine (my development station)
  • Laptop – Windows 7 – x64 – Java 1.6.30 – works fine
  • MacBook – Mac OS 10.5 – x64 – Java 1.6.26 – works fine
  • Desktop – Windows Vista – x86 – Java 1.? – doesn’t work
  • Server – Windows Server 2003 – unknown arch, x86 guessed – Java 1.7 – doesn’t work
  • Desktop – Windows Seven – x86 – Java 1.7 – doesn’t work
  • Desktop – Windows XP – x86 – Java 1.6.31 – doesn’t work

It seems that only x64 hosts can make this to work. The following jars are used:

  • swt : included the x64 version on x64 hosts, and x86 version on x86 hosts
  • sqlitejdbc-v056: apparently this is x86 and x64 compatible
  • opencsv: this doesn’t contain native code
  • iText-2.1.7 and iTextRTF: this doesn’t contain native code

So maybe the JDBC SQLite driver isn’t fully x86-compatible. I’ll try to investigate more.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:07:10+00:00Added an answer on June 5, 2026 at 7:07 am

    TL;DR:
    my SQLite JDBC driver was using native code and was not fully compatible with 32 bits processors.

    Two possible fixes:

    • Use Xerial, a native SQLite JDBC driver that works fine on both Mac OS X 64 bits and Windows 32 bits
    • Use a pure java implementation fixed the issue, at the cost of performance.

    Explanation:

    I’ve spent the past 3 days banging my head to the wall with an SQLite exception saying “SQL logic error or missing database”. I won’t comment on the exception text that includes two possible, different errors without saying which could be the cause. I won’t comment either on the fact that none of the two errors mentioned in the exception text was the cause of the issue.

    Facts:

    • SQLite exception stating “SQL logic error or missing database“
    • Using jsqlitejdbc v056
    • The driver is able to create tables
    • The driver is able to select information from tables
    • The database file is not corrupted, ie. it is possible to open it with a sqlite client and insert data to the tables
    • The driver is unable to insert data into tables

    What solved my issue is replace sqlitejdbc-v056.jar which contains native code by sqlitejdbc-v056-pure.jar which is a pure-java implementation.

    I hope that all the users that had this issue will be able to quickly see this, and not lose 3 days on this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.