Discussion:
malformed database schema - no such table
aramati-S0/
2011-10-24 15:51:20 UTC
Permalink
---------- Forwarded message ----------
From: <aramati-S0/***@public.gmane.org>
Date: 2011/10/24
Subject: malformed database schema - no such table
To: sqlite-users-CzDROfG0BjIdnm+***@public.gmane.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
Adam B
2011-10-24 17:46:22 UTC
Permalink
My guess is that you have a corrupt database. Do a google search on "malformed database schema". You might also want to execute "PRAGMA integrity_check" from a sqlite command line.

You can prove that your code is not the problem be creating a blank database with only the TEST_PERSON table in it.
Post by aramati-S0/
---------- Forwarded message ----------
Date: 2011/10/24
Subject: malformed database schema - no such table
When trying to run a statement on my running db via JDBC I get the following
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)
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
_______________________________________________
SQLiteJDBC mailing list
https://lists.hcoop.net/listinfo/sqlitejdbc
Videx, Inc. | 1105 NE Circle Blvd. | Corvallis, OR 97330 | (541) 738-5500
This email is intended only for the addressee(s) and may include material that is privileged, confidential, and protected from disclosure. No contract is intended. ©2011 Videx, Inc.
aramati-S0/
2011-10-24 17:49:51 UTC
Permalink
Hi Adam,
thank you for your answer. Well, as you said, google search on that
keywords tells you, what you describe.
The problem was the JDBC-Driver. When I chanced it to another driver,
everything works fine.
Thanks!
Tamara
Post by Adam B
My guess is that you have a corrupt database. Do a google search on
"malformed database schema". You might also want to execute "PRAGMA
integrity_check" from a sqlite command line.
You can prove that your code is not the problem be creating a blank
database with only the TEST_PERSON table in it.
Post by aramati-S0/
---------- Forwarded message ----------
Date: 2011/10/24
Subject: malformed database schema - no such table
When trying to run a statement on my running db via JDBC I get the
following
Post by aramati-S0/
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)
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
Post by aramati-S0/
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
Post by aramati-S0/
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.
Post by aramati-S0/
All that is happening is that a cascade of these sql-errors appear
following
Post by aramati-S0/
the next of tables, then the next, ...
What is wrong, here?
Thanks in advance,
Tamara
_______________________________________________
SQLiteJDBC mailing list
https://lists.hcoop.net/listinfo/sqlitejdbc
Videx, Inc. | 1105 NE Circle Blvd. | Corvallis, OR 97330 | (541) 738-5500
This email is intended only for the addressee(s) and may include material
that is privileged, confidential, and protected from disclosure. No
contract is intended. ©2011 Videx, Inc.
_______________________________________________
SQLiteJDBC mailing list
https://lists.hcoop.net/listinfo/sqlitejdbc
Loading...