This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I mean connect to Access tables withouth register .MDb as ODBC data source? I need to deal with many .mdb file without knowing their name (but only know it's *.mdb), and it's impossible to let user register each mdb file. Is there a way to read data from file, or connect to DB directly? Thanks.
SCJP 1.4, SCWCD, SCDJWS
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
posted
0
As far as I know there is no way around other then ODBC DSN.
Sirish Kumar Gongal Reddy
Ranch Hand
Joined: Oct 25, 2004
Posts: 109
posted
0
Hi Will Lee , It's very simple i will tell you, ResuletSet rs=stmt.executeQuery("select * from [Emp$];"); while(rs.next()){ } I hope that your are comfottable with rest of code. Emp: is a table name.
Regards, G Sirish Reddy.,
David Ulicny
Ranch Hand
Joined: Aug 04, 2004
Posts: 724
posted
0
That is exactly what Will don't want to do
SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Sirish Kumar Gongal Reddy
Ranch Hand
Joined: Oct 25, 2004
Posts: 109
posted
0
Hi David Ulicny , what about your comment for my above code plz let me know. Regards, G Sirish Reddy.,
David Ulicny
Ranch Hand
Joined: Aug 04, 2004
Posts: 724
posted
0
Your code is fine, but as I understand Will question, he wants read data from mdb file directly, not through JDBC or ODBC, as you suggested. He wants to do something like:
Thank you guys. Yes, I'm working on an open microscopy environment project (OME) that need to read and parse data from many formats into XML file. The last format I left is the .mdb file. Since there could be uncertain amount of .mdb files with unknown names in many folders, it's impossible to let user register DSN for each of them. Hence I need to find an approach to bypass this step.
I searched similar message on theServerSide.com, it seems a guy tried to do same thing in 2002. There's one reply there: download file from Microsoft and that's it. This person didn't say anything about this magic file and how to deal with it. I checked the MS and didn't find anything useful.
Any more suggestion? Thanks a lot.
Andrew Eccleston
Ranch Hand
Joined: Jul 07, 2004
Posts: 140
posted
0
Hi Will,
It is possible to specify the database to use in your connection url. It's been a while since I've done this, but it should be something close to this:
Oddly enough, where I found useful information about the parameters like the DBQ and DRIVER (there's a number of other parameters) in the string was at Microsoft. Search for DSN-less connections or ADO connections, both using ASP.
Hope this helps.
andrew
The statement below is true.<br />-------------------------------<br />The statement above is false.
public static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver"; public static final String DATABASE = "jdbc dbc RIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb"; public static final String USERNAME = "admin"; public static final String PASSWORD = "";