Package: erlang-odbc Version: 1:14.b-dfsg-1 Severity: normal I have a normal unixodbc installation (no manual configuration) with libsqliteodbc. This works perfectly with pyodbc and other programs which uses odbc:
>>> import pyodbc >>>> context = pyodbc.connect("Driver=SQLITE3;Database=/var/lib/ejabberd_archive/mod_archive.sqlite3;") >>> cursor = context.cursor() >>> t = cursor.execute("select * from archive_messages") >>> c = t.columns() >>> c.fetchall() [('', '', 'archive_collections', 'id', 4, 'INTEGER', 9, 10, 10, 0, 0, None, 'NULL', 4, None, 16384, 1, 'NO').... but when I try to use it using erlang then everything falls apart: > odbc:start(). > odbc:connect("Driver=SQLITE3;Database=/var/lib/ejabberd_archive/mod_archive.sqlite3;", [{scrollable_cursors, off}]). =ERROR REPORT==== 3-Nov-2010::22:46:50 === ODBC: received unexpected info: {tcp_closed,#Port<0.670>} =ERROR REPORT==== 3-Nov-2010::22:46:50 === ** Generic server <0.57.0> terminating ** Last message in was {#Port<0.668>,{exit_status,139}} ** When Server state == {state,#Port<0.668>, {<0.35.0>,#Ref<0.0.0.109>}, <0.35.0>,undefined,on,undefined,undefined,off, connecting,undefined,0, [#Port<0.666>,#Port<0.667>], #Port<0.669>,#Port<0.670>} The file itself is world read and writeable. So I have no idea why erlang-odbc is somewhat special and fails without any usable information. The sqlite3 file was created using $ sqlite3 /var/lib/ejabberd_archive/mod_archive.sqlite3 And then pasting the attached sql into it (+ using .exit after that). --- System information. --- Architecture: amd64 Kernel: Linux 2.6.32-5-amd64 Debian Release: squeeze/sid 500 unstable ftp.debian.org 500 stable ftp.debian.org --- Package information. --- Depends (Version) | Installed =======================================-+-=================== erlang-base (= 1:14.b-dfsg-1) | 1:14.b-dfsg-1 OR erlang-base-hipe (= 1:14.b-dfsg-1) | libc6 (>= 2.7) | 2.11.2-7 unixodbc (>= 2.2.11) | 2.2.14p2-2 Package's Recommends field is empty. Suggests (Version) | Installed ==============================-+-=========== erlang | erlang-manpages | erlang-doc | -- Emil Langrock
CREATE TABLE archive_collections(id INTEGER NOT NULL, prev_id INTEGER, next_id INTEGER, us VARCHAR(2047) NOT NULL, with_user VARCHAR(1023) NOT NULL, with_server VARCHAR(1023) NOT NULL, with_resource VARCHAR(1023) NOT NULL, utc DATETIME NOT NULL, change_by VARCHAR(3071), change_utc DATETIME, deleted INTEGER, subject VARCHAR(1023), thread VARCHAR(1023), crypt INTEGER, extra VARCHAR(32767), PRIMARY KEY(id)); CREATE INDEX IDX_archive_colls_prev_id ON archive_collections(prev_id); CREATE INDEX IDX_archive_colls_next_id ON archive_collections(next_id); CREATE INDEX IDX_archive_colls_us ON archive_collections(us); CREATE INDEX IDX_archive_colls_with_server ON archive_collections(with_server); CREATE INDEX IDX_archive_colls_with_user ON archive_collections(with_user); CREATE INDEX IDX_archive_colls_with_resource ON archive_collections(with_resource); CREATE INDEX IDX_archive_colls_utc ON archive_collections(utc); CREATE INDEX IDX_archive_colls_change_utc ON archive_collections(change_utc); CREATE TABLE archive_messages(id INTEGER NOT NULL, coll_id INTEGER NOT NULL, utc DATETIME NOT NULL, dir INTEGER, body VARCHAR(65535), name VARCHAR(1023), PRIMARY KEY(id)); CREATE INDEX IDX_archive_msgs_coll_id ON archive_messages(coll_id); CREATE INDEX IDX_archive_msgs_utc ON archive_messages(utc); CREATE TABLE archive_jid_prefs(us VARCHAR(2047) NOT NULL, with_user VARCHAR(1023) NOT NULL, with_server VARCHAR(1023) NOT NULL, with_resource VARCHAR(1023) NOT NULL, save INTEGER, expire INTEGER, otr INTEGER, PRIMARY KEY(us, with_user, with_server, with_resource)); CREATE INDEX IDX_archive_jid_prefs_us ON archive_jid_prefs(us); CREATE TABLE archive_global_prefs(us VARCHAR(2047) NOT NULL, save INTEGER, expire INTEGER, otr INTEGER, method_auto INTEGER, method_local INTEGER, method_manual INTEGER, auto_save INTEGER, PRIMARY KEY(us)); CREATE TRIGGER archive_collections_delete BEFORE DELETE ON archive_collections FOR EACH ROW BEGIN DELETE FROM archive_messages WHERE coll_id = OLD.id; UPDATE archive_collections SET prev_id = null WHERE prev_id = OLD.id; UPDATE archive_collections SET next_id = null WHERE next_id = OLD.id; END; CREATE TRIGGER archive_collections_update BEFORE UPDATE ON archive_collections FOR EACH ROW WHEN NEW.deleted = 1 BEGIN DELETE FROM archive_messages WHERE coll_id = NEW.id; UPDATE archive_collections SET prev_id = null WHERE prev_id = NEW.id; UPDATE archive_collections SET next_id = null WHERE next_id = NEW.id; END;