[SQLiteJDBC] Fwd: malformed database schema - no such table

aramati at web.de aramati at web.de
Mon Oct 24 11:51:20 EDT 2011


---------- Forwarded message ----------
From: <aramati at web.de>
Date: 2011/10/24
Subject: malformed database schema - no such table
To: sqlite-users at sqlite.org


Hello @all!

I have a problem which I cannot solve:

When trying to run a statement on my running db via JDBC I get the following
error:

java.sql.SQLException: malformed database schema (B_TEST_IDX) - no such
table: main.BREATHS
    at org.sqlite.DB.throwex(DB.java:288)
    at org.sqlite.NativeDB.prepare(Native Method)
    at org.sqlite.DB.prepare(DB.java:114)
    at org.sqlite.Stmt.executeQuery(Stmt.java:89)
    at eu.aceos.aeroscan.db.DBDAO.getPersons(DBDAO.java:74)
    at eu.aceos.aeroscan.db.DBDAO.main(DBDAO.java:258)
Exception in thread "main" java.lang.NullPointerException
    at eu.aceos.aeroscan.db.DBDAO.getPersons(DBDAO.java:83)
    at eu.aceos.aeroscan.db.DBDAO.main(DBDAO.java:258)

The table has nothing to do with my request, as you will see:

public class DBDAO implements DBInterface {

    private static Connection connection = null;

    //filename ist derzeit der path + filename, derzeit
    //C:\\develop\\aeroscan.sqlite
    public static Connection connect(String filename) {

        if (connection == null) {

            String url = "jdbc:sqlite:"
                   // +  SettingsManager.getInstance().getDBDirectory()
                    + filename;

            try {
                Class.forName("org.sqlite.JDBC"); // Treiber laden
            } catch (Exception e) {
               //todo: logger, dass der Treiber nicht geladen werden konnte
                return null;
            }

            // Verbindung zur Datenbank öffnen (unter Verwendung der
            // Konstanten, die oben definiert wurden)
            try {
                // todo: url noch das user und passwd zufügen!
                connection = DriverManager.getConnection(url);

            } catch (SQLException e) {

               e.printStackTrace();
               return null;
            }
        }
        return connection;
    }



    public ArrayList<TestPerson> getPersons() {
        ResultSet rs = null;
        // ein ganz normales SQL-Statement wird als String angelengt
        String query = "SELECT * FROM TEST_PERSON;";
          // Abfrage durchfuehren und im Fehlerfall eine Meldung ausgeben
        try {
            Statement stmt = connection.createStatement();
            rs = stmt.executeQuery(query);  // Abfrage ausfuehren
        } catch (SQLException e) {
           e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
        }


        try {
            while (rs.next()) {
                System.out.println(rs.getString("NAME")); // NAME ist
Spaltenbezeichnung
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return new ArrayList<TestPerson>();
    }

}

When I drop the table BREATHS, which is actually existing, nothing changes.
All that is happening is that a cascade of these sql-errors appear following
the next of tables, then the next, ...

What is wrong, here?

Thanks in advance,

Tamara


More information about the SQLiteJDBC mailing list