unixODBC: Connect to .mdb in Linux?

Background:

Ah!! Like all the things which you leave and try to forget about .. come back and haunt you . .. there was this old project I was doing .. .(Tags: PDF creation, Servlets JSP, XML parsing, XLS reading) in the year 2007. Of late due to some unforeseen circumstances I had to exhume it & find what the ghost wanted.

Well the UI looked professional and I started exploring it but for some reason Eclipse on my Windows didn’t quite work properly… SVCHOST was eating up all the CPU. So I had to give it a thought to migrate to Ubuntu. But there was this big blocker… ODBC on Unix….     [and the story continues ….]

Stuff I told synaptic to download:

mdbtools
unixODBC

Configuration done using this Link.

/etc/odbcinst.ini

[MDBToolsODBC]
Description = MDB Tools ODBC
Driver = /usr/lib/libmdbodbc.so.0
Setup =
FileUsage =
CPTimeout =
CPReuse =

/etc/odbc.ini

[logindb]
Description = Microsoft Access Try DB
Driver = MDBToolsODBC
Database = /home/nikunj/programming/logindb.mdb
Servername = localhost
Username =
Password =
port = 5432

Done?: (not yet)

nikunj@ubuntu-desktop:~$ isql logindb
+-------------------------------+
| Connected!
| sql-statement
| help [tablename]
| quit
+-------------------------------+
SQL> select name from profile
+-------------------------------+
| name
+-------------------------------+
| Mukesh Kumar Lahoti
| Nikunj Lahoti
| OneTwoThreeFour
| OneTwoThreeee
| M K Lahoti Ji
+-------------------------------+
SQLRowCount returns 5
5 rows fetched

Now [TODO]

1) Connect Java to this ODBC

2) Use MS Excel Connector for Unix+Java.
The Java Excel API is an open source Java API which allows Java developers toread Excel spreadsheets and to generate Excel spreadsheets dynamically.

Advertisements

19 thoughts on “unixODBC: Connect to .mdb in Linux?

  1. Its incomplete ,does that mean that the ghost still haunts u ?:P……………chalo good ,do post the next thing soon 🙂 ,

    • Well its not like I’m looking at a deadline. .. or the ghost is too “haunty” (not a word?) 😛 I’m going to take my sweet own time to go ahead. Right now December 4th is a priority! haha

  2. Thanks for the guide. It works perfectly with single table, but it fails when i try to join tables

    select a.column, b.column from table1 as b, table2 as a where a.column=b.column and a.column=’XXXXXXX’

    Error at Line : syntax error near a.column

    Any Idea?

    • As of now, can’t tell (don’t know). Now that you’ve mentioned it, I’ll try to find out and reply. Also, if its imperative then you should fetch all the rows and later write a method() under Java etc to filter result. What say?

  3. Pingback: 在linux中通过python访问mdb数据库 » Ghoul To World!

  4. Thanks for another magnificent article. The place else may just anyone get that type of information in such a perfect
    approach of writing? I have a presentation subsequent week, and I’m on the search for such information.

  5. Hi.. I follow your instruccions but it fails:

    [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
    [ISQL]ERROR: Could not SQLConnect

    what it can be?

  6. Hi

    Thanks for the post

    the isql runs fine but in connecting to access to db it give me problem.
    Unable to connect to database: java.sql.SQLException: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
    java.sql.SQLException: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)

    Please help

    Regards
    sentil

  7. and here is my odbcinst.ini

    [MDBToolsODBC]
    Description = MDBTools Driver
    Driver = /usr/lib/i386-linux-gnu/odbc/libmdbodbc.so
    Setup = /usr/lib/i386-linux-gnu/odbc/libmdbodbc.so
    FileUsage = 1
    UsageCount = 1
    pls lemme know what im doing wrong.
    Regards
    sentil

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s