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.
😛 LOL i like my OWN post. DUH!
Its incomplete though.
abhi didnt read it 😛 was just wondering that if u posted something ……will read soon 😀
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
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?
Thanks a lot friend, grate article. thanks again
🙂 oh it helped. Great! I am glad.
Pingback: 在linux中通过python访问mdb数据库 » Ghoul To World!
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.
Thanks for dropping a note. You are so kind! 🙂
Amazing how a guide like this lies buried so deep in google! Great post! Thanks.
🙂 I am so glad it worked for you.
Well i tried to cooect but it fails…i used similar files though
Hi Sweta, can you please elaborate? Maybe post the error message that you got!
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?
Hey! What are you exactly trying to do? Connect to SQL? If that’s the case then please try methods other than ODBC!
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
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