Git Product home page Git Product logo

mdbtools's Introduction

Build Status Build status Fuzzing Status

Welcome to the exciting world of MDB Tools! MDB Tools is a set of programs to help you extract data from Microsoft Access files in various settings. See the NEWS file for information about the latest release.

Components

The major pieces of MDB Tools are:

libmdb

The core library that allows access to MDB files programatically. See mdbtools.h for the complete API.

libmdbsql

Builds on libmdb to provide a SQL engine (aka Jet). See mdbsql.h for the complete API.

utils

Provides command line utilities, including:

Command Description
mdb-ver Prints the version (JET 3 or 4) of an mdb file.
mdb-schema Prints DDL for the specified table.
mdb-export Export table to CSV or SQL formats.
mdb-json Export table to JSON format.
mdb-tables A simple dump of table names to be used with shell scripts.
mdb-count A simple count of number of rows in a table, to be used in shell scripts and ETL pipelines.
mdb-sql A simple SQL engine (also used by ODBC and gmdb).
mdb-queries List and print queries stored in the database.
mdb-hexdump* (in src/extras) Simple hex dump utility to look at mdb files.
mdb-array* Export data in an MDB database table to a C array.
mdb-header* Generates a C header to be used in exporting mdb data to a C prog.
mdb-parsecsv* Generates a C program given a CSV file made with mdb-export.

* Deprecated

See the man page of each program for usage instructions.

The src/util directory also contains a number of debugging tools, intended for developers. They are:

Command Description
prcat Prints the catalog table from an mdb file.
prkkd Dump of information about design view data given the offset to it.
prtable Dump of a table definition.
prdata Dump of the data given a table name.
prole Dump of ole columns given a table name and sargs.

These tools are not installed on the host system.

odbc

An ODBC driver for use with unixODBC or iODBC driver manager. Allows one to use MDB files with PHP for example.

gmdb2

The Gnome MDB File Viewer and debugger. Recently ported to GTK+3 and moved to mdbtools/gmdb2.

License

Files in libmdb, libmdbsql, and libmdbodbc are licensed under LGPL and the utilities and gui program are under the GPL, see COPYING.LIB and COPYING files respectively.

Requirements

First, you must have reasonably current installations of:

If you want to build the SQL engine, you'll need bison (version >= 3.0) or byacc, and flex.

If you want to build the ODBC driver, you'll need unixodbc-dev (version 2.2.10 or above) or iodbc.

If you want to build man pages, you'll need GNU awk.

Installation

Latest version is available at https://github.com/mdbtools/mdbtools

Debian

apt install mdbtools

Homebrew

brew install mdbtools

MacPorts

port install mdbtools

From source

If you have cloned the Git repository, you will first need to generate the configure file (skip this step if you have downloaded a formal release):

$ autoreconf -i -f

Then:

$ ./configure

OR for a complete install (requires bison, flex, and unixODBC):

$ ./configure --with-unixodbc=/usr/local

By default, MDB Tools is linked against the copy of GLib returned by pkg-config. You can point to a different GLib installation using the GLIB_CFLAGS and GLIB_LIBS enivornment variables. Or, you can disable GLib entirely with the --disable-glib flag, in which case MDB Tools will use an internal implementation of GLib's functions.

configure can be passed any of the following flags to turn on other capabilities. Note that the options --with-unixodbc and --with-iodbc are mutually exclusive.

--with-unixodbc  specifies the location of the unixODBC driver manager and 
                 causes the unixODBC driver to be built.
--with-iodbc     specifies the location of the iODBC driver manager and 
                 causes the iODBC driver to be built.

By default, the ODBC driver will be installed as /usr/local/lib/odbc/libmdbodbc.so, with a Unicode-capable driver at /usr/local/lib/odbc/libmdbodbcW.so.

The command configure --help will give you the list of mdbtools specific options.

$ make

Once MDB Tools has been compiled, libmdb.[so|a] will be in the src/libmdb directory and the utility programs will be in the src/util directory.

You can then install (to /usr/local by default) by running the following as root:

$ make install

Some systems will also need the ld cache to be updated after installation; You can do that running:

$ ldconfig

Hacking

If you are interested in helping, read the HACKING file for a description of where the code stands and what has been gleened of the file format.

Contact

Please send bug reports to the new github repository. https://github.com/mdbtools/mdbtools/issues

mdbtools's People

Contributors

0xced avatar adamv avatar bob620 avatar brianb avatar brjohnsn avatar chatcannon avatar cyberemissary avatar danchr avatar doraemoncito avatar evanmiller avatar ewenmcneill avatar filmor avatar h3xx avatar jahlborn avatar jakob avatar jimmytaker avatar jwrdegoede avatar kaukov avatar leecher1337 avatar mcuelenaere avatar mjwoodcock avatar mlocati avatar nirgal avatar nyalldawson avatar ockham avatar paulfitz avatar rhurlin avatar rogerswb avatar rutsky avatar samshawsds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mdbtools's Issues

compile error when building --with-iodbc (iodbcinst.h: No such file or directory)

The file exists, and I set --with-iodbc=/usr/include/libiodbc which points to the location of "iodbcinst.h".

Linux archasus 3.12.13-1-ck #1 SMP PREEMPT Sat Feb 22 18:08:42 EST 2014 x86_64 GNU/Linux
gcc (GCC) 4.8.2 20140206 (prerelease)
cc (GCC) 4.8.2 20140206 (prerelease)
libiodbc 3.52.8

But it just results in:

make[2]: Entering directory '/tmp/makepkg/mdbtools-git/src/mdbtools/src/odbc'
  CC       odbc.lo
In file included from odbc.c:28:0:
mdbodbc.h:27:24: fatal error: iodbcinst.h: No such file or directory
 # include <iodbcinst.h>
                        ^
compilation terminated.
Makefile:482: recipe for target 'odbc.lo' failed

Re installing leaves old files. ??

This isn't a bug, so much as a question from a newb.

I have run Configure, Make and Make Install; but I got an error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mdbtools.so' - libmdb.0: cannot open shared object file: No such file or directory in Unknown on line 0

And when I made a symlink to fix this, I got another error:

mdb_init() is DEPRECATED and does nothing. Stop calling it.

I am affraid that there are old files being left after my previous install. How do I fix this?

doc/reference/libmdb isn't generated

I recompiled my git source with make clean&& ./configure --enable-gtk-doc&&make

The config.status has then
S["ENABLE_DOCBOOK_FALSE"]=""
S["ENABLE_DOCBOOK_TRUE"]="#"
S["ENABLE_GTK_DOC_FALSE"]="#"
S["ENABLE_GTK_DOC_TRUE"]=""

and compilation never goes to reference directory or generate makefile.

Might be just my problem but the reference would be interesting. to have in web or as local copy.

select count(*) from <table>

Is there some way to get
→ select count(*) from table
from one of mdbtools?

Maybe something like this:
→ mdb-sql my_mdb "select count(*) from table"
or there is a property in mdb-prop?
→ mdb-prop my_mdb my_table "CountRecords"

Regards

memory leak under valgrind

when I run mdbtools under valgrind. It reported some memory leak issue. The following are the position that leak come from:

  1. data.c:930
    It seems that miss a 'break' in the 'case' block.
  2. odbc.c 1626
    The memory need to be release here.

mdbexport should escape CR and LF

If a field contains CR and/or LF, then mdbexport simply puts this unescaped to the output.
There should be an option (e.g -e) to escape CR and LF to \r and \n
(Maybe this should be escaped always ?)

Issue for tables only have one column

When i read data through odbc interface, if the table just have one column, mdbtools only return the first row. Other rows are missed.

It seems that stmt.icol is not reset when cursor go to next row.

./configure: line 11613: syntax error near unexpected token `GLIB,' ./configure: line 11613: `PKG_CHECK_MODULES(GLIB, glib-2.0, ,'

centos6

checking whether /usr/bin/ld -m elf_x86_64 accepts --as-needed... yes
./configure: line 11613: syntax error near unexpected token `GLIB,'
./configure: line 11613: `PKG_CHECK_MODULES(GLIB, glib-2.0, ,'

the offending lines:

PKG_CHECK_MODULES(GLIB, glib-2.0, ,
        as_fn_error $? "                                                                                                                                                                                                                                                                                                    
glib 2.0 is required by MDB Tools (runtime and devel).                                                                                                                                                                                                                                                                      
It can be downloaded at www.gtk.org.                                                                                                                                                                                                                                                                                        
" "$LINENO" 5)

pyodbc.Error: ('HY000', 'The driver did not supply an error!')

O: debian wheezy

Code:

-- coding: utf-8 --

import os
import pyodbc

db_path = "bd1.mdb"
print db_path

odbc_connection_str = 'DRIVER={MDBTools};DBQ=%s;User Id=admin;Password=;' % (db_path)

connection = pyodbc.connect(odbc_connection_str)
cursor = connection.cursor()

queries = []
queries.append( "SELECT * FROM TABLE1")
queries.append( "SELECT * FROM TABLE2")

for query in queries:
print query
cursor.execute(query)
rows = cursor.fetchall()
for row in rows:
print row

output:
SELECT * FROM TABLE1
('00001\x00', '12345\x00', None)
('00002\x00', '12346\x00', None)
SELECT * FROM TABLE2
Traceback (most recent call last):
File "/home/eu/pro/cpun/src/script.py", line 19, in
cursor.execute(query)
pyodbc.Error: ('HY000', 'The driver did not supply an error!')

I think that the problem are fields type numeric.
The TABLE2 have a numeric field.
Exist any solution?

Very thnaks!!

Undocumented compilation dependency on glib2 on Ubuntu

Compiling from source on Ubuntu 10.04.2, I got an error something like this when running autogen.sh

./configure: line 14744: syntax error near unexpected token 2.0.0' ./configure: line 14744:AM_PATH_GLIB_2_0(2.0.0)'

(line # is not exactly right, but I don't think that matters.)

I was able to solve this problem by installing libglib2.0-dev with "apt-get install libglib2.0-dev".

compile fails: invalid conversion from gpointer in catalog.c

Hi, I'm trying to compile github master branch on FreeBSD 10-RC5 using gcc 4.6 (g++46). I applied the configure.ac patch patch to avoid "configure: error: conditional "ENABLE_SK" was never defined" (#37), autoreconf and configure both run without error, then gmake fails:

root@firefly:/work/mdbtools # gmake
Making all in src
gmake[1]: Entering directory /root/work/mdbtools/src' Making all in libmdb gmake[2]: Entering directory/root/work/mdbtools/src/libmdb'
CC catalog.lo
catalog.c: In function 'char* mdb_get_objtype_string(int)':
catalog.c:40:3: warning: deprecated conversion from string constant to 'char_' [-Wwrite-strings]
...
catalog.c: In function 'GPtrArray_ mdb_read_catalog(MdbHandle_, int)':
catalog.c:103:51: warning: deprecated conversion from string constant to 'gchar_ {aka char_}' [-Wwrite-strings]
...
catalog.c:108:14: error: invalid conversion from 'gpointer {aka void_}' to 'MdbColumn_' [-fpermissive]
catalog.c: In function 'MdbCatalogEntry_ mdb_get_catalogentry_by_name(MdbHandle_, const gchar_)':
catalog.c:149:11: error: invalid conversion from 'gpointer {aka void_}' to 'MdbCatalogEntry_' [-fpermissive]
catalog.c: In function 'void mdb_dump_catalog(MdbHandle_, int)':
catalog.c:164:25: error: invalid conversion from 'gpointer {aka void_}' to 'MdbCatalogEntry_' [-fpermissive]
gmake[2]: *_* [catalog.lo] Error 1
gmake[2]: Leaving directory /root/work/mdbtools/src/libmdb' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory/root/work/mdbtools/src'
gmake: *** [all-recursive] Error 1
root@firefly:
/work/mdbtools #

configure: error: "glib-2.0 not found by pkg-config"

When trying to install mdbtools through pecl on CentOS 6.4:

# pecl install mdbtools
downloading mdbtools-1.0.0.tgz ...
Starting to download mdbtools-1.0.0.tgz (8,783 bytes)
.....done: 8,783 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
mdbtools installation directory? [autodetect] :
building in /var/tmp/pear-build-userdqScyr/mdbtools-1.0.0
running: /var/tmp/mdbtools/configure --with-mdbtools
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking mdbtools installation prefix... yes, shared
checking for pkg-config... /usr/bin/pkg-config
configure: error: "glib-2.0 not found by pkg-config"
ERROR: `/var/tmp/mdbtools/configure --with-mdbtools' failed

mdbtools returns integer column values as a truncated string when retrieved via binding

For a long integer column (4 bytes):

  • SQLGetData with type = integer will return the data as a 4 byte integer (OK)
  • SQLGetData with type = char will return the data as a string (OK?)
  • SQLBindCol with type = char will return the data as a string (OK?)
  • SQLBindCol with type = integer will return 4 chars which represent the 1st 4 ascii codes of the integer (BUG). For example, the value 100123 will be returned as 0x31, 0x30, 0x30, 0x31 rpresenting '1001', instead of 100123 as a 4 byte integer.
    I have traced this to _mdb_attempt_bind in data.c which treats BOOL types correctly, but defers all other types to mdb_xfer_bound_data which in turn treats MDB_NUMERIC types in one way, and all remaining types (including INTEGER, BYTE, etc...) as string.

problem with -D option

Hello,

i try to export Data from tables that have date und datetime fields but the format in both fields is wrong in the export file.
So I that “-D %F” option to get the right format for date fields but I see that that mdb-export apply this format to date and datetime fields. When I that “-D %T” option I get the right datetime format, datetime fields have the right format but the date fields format is broken.

Is it possible to that different formats for date and datetime fields on export?

Best regards,
Ilativ

mdb-export fails with a g_hash_table_lookup error

I'm on Ubuntu 12.04: I installed mdbtools through the package manager and have the following problem:
I type: mdb-export myfile.mdb mytable
I get: GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed"
I then compiled from this repository (and used Fix #37 to get the configure to work) and I still get the same result.
My ldd --version returns:
ldd (Ubuntu EGLIBC 2.15-0ubuntu10.5) 2.15
Any ideas?

Newly install binaries can't find libmdb on Ubuntu

After compiling from source on Ubuntu 10.04.2 with (autogen.sh; make; sudo make install), I get an error when I run the newly installed mdb-export or any of the other mdb-* tools, saying something like "can't find libmdb.so.1". libmdb.so and cohorts were correctly installed in /usr/local/lib, but the binaries were linked against a library that they could no longer find.

I was able to resolve this problem by running the normal install (as above), then doing:
export LD_RUN_PATH=/usr/local/lib
make clean
./configure
make
sudo make install

Github repository status

I see that MDB Tools on SourceForge is still active: it has relatively recent bug reports and messages in mailing list.
Official page http://mdbtools.sourceforge.net says that code can be obtained from CSV repository on SourceForge.

What is the status of this Github repository? Shouldn't bug reports to be moved in one place and official page updated?

Possible Fixes for two Different Segfaults

Please excuse the means at which i'm sending this patch. Very Very new to github.

While importing my data, i encounted two segfaults. I know very little about MDB/JET file format but these are the two fixes I added to allow my project to proceed. Thought I would share the fixes.

  1. iconv.c mdb_unicode2ascii - EILSEQ - An invalid multibyte sequence has been encountered in the input. Added Check.
  2. Zero length multiple page meno fields. Add checked to stop processing if the length is zero.
diff --git a/src/libmdb/data.c b/src/libmdb/data.c
index 891addb..6c7658a 100644
--- a/src/libmdb/data.c
+++ b/src/libmdb/data.c
@@ -735,6 +735,11 @@ static char *mdb_memo_to_string(MdbHandle *mdb, int start, int size)
                        if (tmpoff + len - 4 > memo_len) {
                                break;
                        }
+
+                       if(len == 0) {
+                               break;
+                       }
+
                        memcpy(tmp + tmpoff, buf + row_start + 4, len - 4);
                        tmpoff += len - 4;
                } while (( pg_row = mdb_get_int32(buf, row_start) ));
diff --git a/src/libmdb/iconv.c b/src/libmdb/iconv.c
index adc95b0..932c6e7 100644
--- a/src/libmdb/iconv.c
+++ b/src/libmdb/iconv.c
@@ -70,6 +70,8 @@ mdb_unicode2ascii(MdbHandle *mdb, char *src, size_t slen, char *dest, size_t dle
        //printf("1 len_in %d len_out %d\n",len_in, len_out);
        while (1) {
                iconv(mdb->iconv_in, &in_ptr, &len_in, &out_ptr, &len_out);
+
+               if ((!len_in) || (errno == EILSEQ)) break;
                if ((!len_in) || (errno == E2BIG)) break;
                /* Don't bail if impossible conversion is encountered */
                in_ptr += (IS_JET3(mdb)) ? 1 : 2;

Schema setting doesn't append to sequences

Hi Brian,

Not sure whether you use this issue tracker, but since I'm tracking a fork, I do :-) I'll work on a patch for this downstream.

Running mdb-export with -N "source." generates the following CREATE TABLES ...

CREATE TABLE source."SpcClimChangeModelResults"

but the schema is not appended to sequences:

CREATE SEQUENCE "SpcClimChangeModelResults_SpcClimChangeModelRecID_seq" OWNED BY "SpcClimChange ModelResults"."SpcClimChangeModelRecID";
ALTER TABLE "SpcClimChangeModelResults" ALTER COLUMN "SpcClimChangeModelRecID" SET DEFAULT pg_catalog.nextval('"SpcClimChangeModelResults_SpcClimChangeModelRecID_seq"');

Mac OS 10.7(.4): ld: unknown option

I downloaded a zip of the current release and ran ./autogen.sh
It finished, printing:
Now type 'make' to compile MDBTools.
I typed make:
Making all in src
Making all in libmdb
CC catalog.lo
CC mem.lo
CC file.lo
file.c: In function ‘_mdb_read_pg’:
file.c:367: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
file.c:367: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
CC table.lo
CC data.lo
CC dump.lo
CC backend.lo
CC money.lo
CC sargs.lo
CC index.lo
CC like.lo
CC write.lo
write.c: In function ‘mdb_write_pg’:
write.c:83: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
write.c:83: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
CC stats.lo
CC map.lo
CC props.lo
CC worktable.lo
CC options.lo
CC iconv.lo
CCLD libmdb.la
ld: unknown option: --version-script=./libmdb.map
collect2: ld returned 1 exit status
make[2]: *** [libmdb.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Any ideas? I'm running Mac OS 10.7.4 with XCode 4.2.1.

Thank you!

mdbtools - odbc support for Mac OS X

Hi,

I tried to compile odbc support for Mac OS X. I got his error. Anybody got a solution to compile this library?

Here's the error.

Nolis-MacBook-Pro:odbc nsicad$ make
  CC       odbc.lo
odbc.c:40:1: error: unknown type name 'iconv_t'
odbc.c: In function 'my_init':
odbc.c:120:3: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat]
odbc.c:120:3: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat]
odbc.c:130:2: warning: implicit declaration of function 'iconv_open' [-Wimplicit-function-declaration]
odbc.c: In function 'my_fini':
odbc.c:136:19: error: 'iconv_t' undeclared (first use in this function)
odbc.c:136:19: note: each undeclared identifier is reported only once for each function it appears in
odbc.c:136:2: warning: implicit declaration of function 'iconv_close' [-Wimplicit-function-declaration]
odbc.c: In function 'unicode2ascii':
odbc.c:143:2: warning: implicit declaration of function 'iconv' [-Wimplicit-function-declaration]
odbc.c: In function '_SQLDriverConnect':
odbc.c:255:1: warning: 'SQLDriverConnect' is deprecated (declared at /usr/include/sqlext.h:2357) [-Wdeprecated-declarations]
odbc.c: In function '_SQLConnect':
odbc.c:707:1: warning: 'SQLConnect' is deprecated (declared at /usr/include/sql.h:859) [-Wdeprecated-declarations]
odbc.c: In function '_SQLDescribeCol':
odbc.c:816:1: warning: 'SQLDescribeCol' is deprecated (declared at /usr/include/sql.h:884) [-Wdeprecated-declarations]
odbc.c: At top level:
odbc.c:820:19: error: conflicting types for 'SQLDescribeColW'
In file included from /usr/include/sqlext.h:2570:0,
                 from odbc.c:27:
/usr/include/sqlucode.h:148:19: note: previous declaration of 'SQLDescribeColW' was here
odbc.c: In function 'SQLDescribeColW':
odbc.c:835:3: warning: passing argument 7 of '_SQLDescribeCol' from incompatible pointer type [enabled by default]
odbc.c:803:26: note: expected 'long unsigned int *' but argument is of type 'SQLUINTEGER *'
odbc.c: In function '_SQLColAttributes':
odbc.c:924:1: warning: 'SQLColAttributes' is deprecated (declared at /usr/include/sqlext.h:2385) [-Wdeprecated-declarations]
odbc.c: At top level:
odbc.c:928:19: error: conflicting types for 'SQLColAttributesW'
In file included from /usr/include/sqlext.h:2570:0,
                 from odbc.c:27:
/usr/include/sqlucode.h:130:19: note: previous declaration of 'SQLColAttributesW' was here
odbc.c: In function 'SQLColAttributesW':
odbc.c:938:3: warning: passing argument 7 of '_SQLColAttributes' from incompatible pointer type [enabled by default]
odbc.c:913:26: note: expected 'long int *' but argument is of type 'SQLINTEGER *'
odbc.c:942:3: warning: passing argument 7 of '_SQLColAttributes' from incompatible pointer type [enabled by default]
odbc.c:913:26: note: expected 'long int *' but argument is of type 'SQLINTEGER *'
odbc.c: In function '_SQLError':
odbc.c:1008:1: warning: 'SQLError' is deprecated (declared at /usr/include/sql.h:905) [-Wdeprecated-declarations]
odbc.c: In function '_SQLExecDirect':
odbc.c:1085:1: warning: 'SQLExecDirect' is deprecated (declared at /usr/include/sql.h:915) [-Wdeprecated-declarations]
odbc.c: In function '_SQLColumns':
odbc.c:1449:1: warning: 'SQLColumns' is deprecated (declared at /usr/include/sql.h:848) [-Wdeprecated-declarations]
odbc.c: In function '_SQLGetData':
odbc.c:1659:1: warning: 'SQLGetData' is deprecated (declared at /usr/include/sql.h:969) [-Wdeprecated-declarations]
odbc.c: In function 'SQLGetDataW':
odbc.c:1675:2: warning: passing argument 6 of '_SQLGetData' from incompatible pointer type [enabled by default]
odbc.c:1649:19: note: expected 'long int *' but argument is of type 'SQLINTEGER *'
odbc.c: In function '_SQLGetInfo':
odbc.c:1903:1: warning: 'SQLGetInfo' is deprecated (declared at /usr/include/sql.h:1031) [-Wdeprecated-declarations]
make: *** [odbc.lo] Error 1
Nolis-MacBook-Pro:odbc nsicad$ 

compile error when building --with-unixodbc (libfl.so: undefined reference to `yylex')

Is this a bison/flex issue?

Linux archasus 3.12.13-1-ck #1 SMP PREEMPT Sat Feb 22 18:08:42 EST 2014 x86_64 GNU/Linux
bison (GNU Bison) 3.0.2
flex 2.5.38
unixodbc 2.3.2

I've tried compiling using --with-unixodbc=/usr/include, --with-unixodbc=/usr/lib and just --with-unixodbc but they result in same error.

Making all in odbc
make[2]: Entering directory '/tmp/makepkg/mdbtools-git/src/mdbtools/src/odbc'
  CC       odbc.lo
  CC       connectparams.lo
  CCLD     libmdbodbc.la
  CC       libmdbodbcW_la-odbc.lo
  CC       libmdbodbcW_la-connectparams.lo
  CCLD     libmdbodbcW.la
  CC       unittest.o
  CCLD     unittest
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libfl.so: undefined reference to `yylex'
collect2: error: ld returned 1 exit status```

Results out of order for tables > 1000 rows

When exporting an entire table using mdb-export or executing a query using mdb-sql, the results are sometimes out of order. I have only observed this behavior on tables with more than 1000 rows, and when using mdb-export the disorder doesn't show up until more than 1000 rows into the result. I just tried an mdb-sql query against a table with < 2M rows, to fetch the last ~100 rows, and the results were out of order. The "order" I mention comes from the fact that I'm exporting time-series data that were written sequentially, and we have an integer "Data_Point" column which increments by 1.

I have observed these results both in MacOS 10.x and Ubuntu 12.04. I'm using version 0.7rc1 installed via apt-get.

I'm not sure if the MS JET4 database format guarantees any sort of order within a table, but it would be great not to have to sort a huge CSV after exporting it using mdbtools. Overall I find mdbtools very useful and I rely on them heavily. I can provide sample files/commands/queries that demonstrate the behavior I describe if that would be helpful.

configure fails with "ENABLE_SK was never defined"

Hi,

trying to build mdbtools on Ubuntu 13.10. However, ./configure bails with the following message:

configure: error: conditional "ENABLE_SK" was never defined.
Usually this means the macro was only invoked conditionally.

A quick search suggested that maybe gnome-doc-utils had to be installed. However, this did not fix the problem.

Regards

mdb-export reporting zero rows

I just came across an mdb file where mdb-export reports it having zero rows. MDB Viewer on my mac shoes it clearly having several thousand rows.

mdb-prop seems to handle MDB_DATETIME incorrectly.

When using mdb-prop to extract some properties, I noticed that properties stored as DateTime were being output incorrectly.

Example:

$ mdb-prop TestingTen/TheTestingTen.ssm UserDefined | grep Date
        QualifyDate: 01/107/00 -1011703407:-30:-8
        MeetingDate: 12/30/99 00:00:00
$ 

After playing about a bit, I came up with the following very-simple patch which seems to resolve the issue:

diff --git a/src/libmdb/data.c b/src/libmdb/data.c
index 891addb..ab97fad 100644
--- a/src/libmdb/data.c
+++ b/src/libmdb/data.c
@@ -31,7 +31,7 @@ char *mdb_numeric_to_string(MdbHandle *mdb, int start, int prec, int scale);

 static int _mdb_attempt_bind(MdbHandle *mdb,
        MdbColumn *col, unsigned char isnull, int offset, int len);
-static char *mdb_date_to_string(MdbHandle *mdb, int start);
+static char *mdb_date_to_string(void *buf, int start);
 #ifdef MDB_COPY_OLE
 static size_t mdb_copy_ole(MdbHandle *mdb, void *dest, int start, int size);
 #endif
@@ -827,11 +827,11 @@ mdb_date_to_tm(double td, struct tm *t)
 }

 static char *
-mdb_date_to_string(MdbHandle *mdb, int start)
+mdb_date_to_string(void *buf, int start)
 {
        struct tm t;
        char *text = (char *) g_malloc(MDB_BIND_SIZE);
-       double td = mdb_get_double(mdb->pg_buf, start);
+       double td = mdb_get_double(buf, start);

        mdb_date_to_tm(td, &t);

@@ -941,7 +941,7 @@ char *mdb_col_to_string(MdbHandle *mdb, void *buf, int start, int datatype, int
                        }
                break;
                case MDB_DATETIME:
-                       text = mdb_date_to_string(mdb, start);
+                       text = mdb_date_to_string(buf, start);
                break;
                case MDB_MEMO:
                        text = mdb_memo_to_string(mdb, start, size);

Which seems to resolve the problem:

$ /tmp/mdbtools/src/util/mdb-prop TestingTen/TheTestingTen.ssm UserDefined | grep Date
        QualifyDate: 08/28/98 00:00:00
        MeetingDate: 08/28/98 19:00:00
$

However, I'm lacking in the C deparment - My C is very much at a "hack-it-and-see-if-it-works" level rather than actually understanding what is going on here, so I'm not entirely sure if this patch is sensible, or why it works. (As far as I can see *buf in mdb_col_to_string is just mdb->pg_buf already?)

When generating the schema with the MySQL backend, the column comments use an incompatible syntax

This is part of the generated output:

CREATE TABLE `b00836`
 (
        `codigpw`                       int, 
        `imingpw`                       float, 
        `icorgpw`                       float, 
        `itragpw`                       float, 
        `nombgpw_es`                    varchar (80), 
        `nombgpw_ca`                    varchar (80), 
        `nombgpw_en`                    varchar (80), 
        `nombgpw_fr`                    varchar (80), 
        `nombgpw_de`                    varchar (80), 
        `nombgpw`                       varchar (80)
);
COMMENT ON COLUMN `b00836`.`codigpw` IS 'Codigo de grupo';
COMMENT ON COLUMN `b00836`.`imingpw` IS 'Importe minimo';
COMMENT ON COLUMN `b00836`.`icorgpw` IS 'Portes por correo';
COMMENT ON COLUMN `b00836`.`itragpw` IS 'Portes por transportista';
COMMENT ON COLUMN `b00836`.`nombgpw_es` IS 'Descripcion del grupo';
COMMENT ON COLUMN `b00836`.`nombgpw_ca` IS 'Descripcion del grupo';
COMMENT ON COLUMN `b00836`.`nombgpw_en` IS 'Descripcion del grupo';
COMMENT ON COLUMN `b00836`.`nombgpw_fr` IS 'Descripcion del grupo';
COMMENT ON COLUMN `b00836`.`nombgpw_de` IS 'Descripcion del grupo';
COMMENT ON COLUMN `b00836`.`nombgpw` IS 'Descripcion del grupo';
COMMENT ON TABLE `b00836` IS 'Grupo de paises';

The comments should either be added for each column inside the CREATE TABLE definition or using an ALTER TABLE syntax. Examples:

-- Integrated with the CREATE TABLE syntax
CREATE TABLE `b00836`
 (
        `codigpw`                       int COMMENT 'Codigo de grupo', 
        `imingpw`                       float COMMENT 'Importe minimo', 
        `icorgpw`                       float COMMENT 'Portes por correo', 
        `itragpw`                       float COMMENT 'Portes por transportista', 
        `nombgpw_es`                    varchar (80) COMMENT 'Descripcion del grupo', 
        `nombgpw_ca`                    varchar (80) COMMENT 'Descripcion del grupo', 
        `nombgpw_en`                    varchar (80) COMMENT 'Descripcion del grupo', 
        `nombgpw_fr`                    varchar (80) COMMENT 'Descripcion del grupo', 
        `nombgpw_de`                    varchar (80) COMMENT 'Descripcion del grupo', 
        `nombgpw`                       varchar (80) COMMENT 'Descripcion del grupo'
)
COMMENT 'Grupo de paises';

-- Alternative syntax
ALTER TABLE `b00836` CHANGE `codigpw` `codigpw` int COMMENT 'id of user';
ALTER TABLE `b00836` CHANGE `imingpw` `imingpw` float COMMENT 'Importe minimo';
ALTER TABLE `b00836` CHANGE `icorgpw` `icorgpw` float COMMENT 'Portes por correo';
ALTER TABLE `b00836` CHANGE `itragpw` `itragpw` float COMMENT 'Portes por transportista';
ALTER TABLE `b00836` CHANGE `nombgpw_es` `nombgpw_es` varchar (80) COMMENT 'Descripcion del grupo';
ALTER TABLE `b00836` CHANGE `nombgpw_ca` `nombgpw_ca` varchar (80) COMMENT 'Descripcion del grupo';
ALTER TABLE `b00836` CHANGE `nombgpw_en` `nombgpw_en` varchar (80) COMMENT 'Descripcion del grupo';
ALTER TABLE `b00836` CHANGE `nombgpw_fr` `nombgpw_fr` varchar (80) COMMENT 'Descripcion del grupo';
ALTER TABLE `b00836` CHANGE `nombgpw_de` `nombgpw_de` varchar (80) COMMENT 'Descripcion del grupo';
ALTER TABLE `b00836` CHANGE `nombgpw` `nombgpw` varchar (80) COMMENT 'Descripcion del grupo';
ALTER TABLE `b00836` COMMENT 'Grupo de paises';

Access 2013 support

It would be great if mdbtools could support Access 2013 files as well. As it already supports Access 2010 files, I hope it's not a big deal to implement this enhancement.

When trying to connect to an Access 2013 file, mdbtools exits with the following error: "Unknown Jet version."

Access 2010 files with the same file suffix (.accdb) work just fine.

Not possible to select from any table using unixODBC & Oracle

I installed mdbtools today, configured with unixODBC.

When I'm using:
"mdb-tables file.MDB" - everything is fine

"isql -v MDB
select * from a" - works fine too.

... but I have a problem when I tried to use this ODBC connection in Oracle 10g.

"select 'a' from dual@mdb" works fine (so odbc itself is working), but select from normal table (that exists) results:

[Generic Connectivity Using ODBC]DRV_DescribeTable: Record A has no fields. Loading failed
ORA-02063: preceding 2 lines from MDB
00942. 00000 - "table or view does not exist"

using double quotes, single quotes doesn't work.

In log file I have:

DRV_DescribeTable: Record A has no fields. Loading failed
nvRETURN (./drv_priv.c 962): -2202
hoadtab (26): ; hoadtab Exited with retcode = 0.
hoapars (15): ; hoapars Entered. stmtType = 0, id = 1.
nvOUT (./qp_sqtxt.c 89): SELECT * FROM "A"
odbc_rec: select * from �A�

DRV_DescribeTable: Record A has no fields. Loading failed
nvRETURN (./drv_priv.c 962): -2202
[A00D] Failed to open table hsmdb:A
nvRETURN (./qpbldbtn.c 482): -2202
nvRETURN (./qpbldbtn.c 367): -2202
nvRETURN (./qp_seman.c 3193): -2202
nvRETURN (./qp_yacc.c 1958): -2202
nvRETURN (./qp_compl.c 508): -2202
nvRETURN (./qp_compl.c 225): -2202
nvRETURN (./qp_compl.c 193): -2202
hoapars (15): ; hoapars Exited with retcode = 942.

I know nothing about log above, but odbc_rec has strange characters on both sides of selected table name

My System: SuSE 10
Linux MIS6 2.6.16.60-0.37_f594963d-bigsmp #1 SMP Mon Mar 23 13:39:48 UTC 2009 i686 i686 i386 GNU/Linux
Oracle 10.2.0.4.0
unixODBC: 2.2.10

Other ODBC connections (to Advantage Database Server, SQL Server) works fine.

mdb-export produce many malformed utf 8 characters

I have mdb database (JET4), when i use mdb-viewer for produce csv file all works fine. But when i use mdb-export for convert same mdb, output csv contains a lot of malformed characters and result file almost unredable. I try to use enviroment variables for manually set charset to UTF-8 but unsucessfull.

For convertation i use command:

mdb-export -d ';' something.mdb Main > Main.csv

Mdb viewer works perfect but i have a many databases so i need console tool.

small typo in autogen.sh

autogen.sh has a small typo that prevented me to build the software.

line 22:
if which libtoolize && (libtooloze --version) < /dev/null > /dev/null 2>&1; then

should be:
if which libtoolize && (libtoolize --version) < /dev/null > /dev/null 2>&1; then

i.e. libtoolize in stead of libtooloze.

libtool fails on ODBC library

Trying to build the full suite of tools and I get this error:

make[2]: Entering directory /home/agency/dev/mdbtools/src/odbc' CC odbc.lo CC connectparams.lo CCLD libmdbodbc.la ../../libtool: line 5986: cd: yes/lib: No such file or directory libtool: link: cannot determine absolute directory name ofyes/lib'
make[2]: *** [libmdbodbc.la] Error 1

autogen.sh, and configure both seem to succeed, but make never makes it past this point.

In config.log, I found this:

configure:11910: gcc -o conftest -g -O2 -DSQL -Wall -DUNIXODBC -Wl,--as-needed -Lyes/lib conftest.c -lodbcinst >&5

And this:

ODBC_LIBS='-Lyes/lib -lodbcinst'

It doesn't seem to be a common problem, though I've found other cases of the same thing happening with other packages: http://www.open-mpi.org/community/lists/users/2009/04/8866.php

How to build mdbtools on Lion, Thanks!

I tried to build mdbtools on my lion (10.7.5), always failed as follow:

./autogen.sh
....
...
checking for bison... bison -y
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking wordexp.h usability... yes
checking wordexp.h presence... yes
checking for wordexp.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for iconv... yes
checking for iconv declaration...
extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking whether the target supports symbol aliases... no
checking Are we using flex ... yes
checking whether /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld accepts --as-needed... no
./configure: line 12369: syntax error near unexpected token GLIB,' ./configure: line 12369:PKG_CHECK_MODULES(GLIB, glib-2.0, ,'

I tried to install fink and glib2-dev, still not resolve the problem.

Any friends can give me help?

Thanks in advance!

Can I build 7.1.0 on Ubuntu Lucid?

I need to backport mdbtools 7.1.0 to use on Ubuntu Lucid (via a heroku buildpack). I'm pretty sure this means I need to build 7.1.0 on a Lucid box, then I can package up the binaries to deploy on heroku.

When I try to start the build process, I get:

ubuntu@ip-10-147-4-122:~/mdbtools$ git checkout 0.7.1
HEAD is now at f8ce1cc... Releasing version 0.7.1
ubuntu@ip-10-147-4-122:~/mdbtools$ git describe
0.7-138-gf8ce1cc
ubuntu@ip-10-147-4-122:~/mdbtools$ autoreconf -i -f
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 189.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 189.
configure.ac:14: warning: macro `AM_PROG_AR' not found in library
configure.ac:14: error: possibly undefined macro: AM_PROG_AR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

"configure" script should _require_ "bison" or "yacc"

Compiling mdbtools requires yacc (or bison ?) apparently. But the configure script doesn't bark if neither of them is present on the system, even though it specifically look for them. Only in the compilation phase is the issue brought up.
Is it done on purpose?

README inconsistency

README file indicates that mdb-dump is located in the utils folder.
However, mdb-hexdump is in the extras folder.

update to README needed?

doesnt build on OSX 10.7

not a priority as I have a unix box that this builds successfully on, but I figured I should open the issue in case others are googling

first I get

write.c:39: error: only weak aliases are supported in this configuration
write.c:49: error: only weak aliases are supported in this configuration
write.c:59: error: only weak aliases are supported in this configuration

when I edit the lines to add weak e.g. __attribute__((weak, alias("mdb_put_int32_msb"))); I get this:

write.c:33: warning: alias definitions not supported; ignored
write.c:43: warning: alias definitions not supported; ignored
write.c:53: warning: alias definitions not supported; ignored

and then further down

ld: unknown option: --version-script=./libmdb.map
collect2: ld returned 1 exit status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.