I have a .mdb(acces file ).I want to open this mdb file by java programme .This means that whenever i run my java code with the path of mdb specified in the code, the mdb file should open up .Can any one help me out how to do this? Thanks Amin
You have to use JDBC. There is a little bit of learning that you have to do if you've never used JDBC. You also have to set up your environment for your DSN. There is a JDBC tutorial with examples at Sun's site. ------------------ Bosun SCJP for the Java� 2 Platform
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
You can also access it without a DSN using: jdbc dbc:MS Access Database;DBQ="C:\\Somewhere\\DB.mdb" If you are using Microsoft Office 97 then replace "MS Access Database" with "MS Access 97 Database". If it doesn't work, go to your Control Panel and click on ODBC. Replace "MS Access Database" with whatever is there. HTH
Joined: May 17, 2001
BTW, how do you get rid of the :O ? is there a way to "escape" the smiley?
Originally posted by aminur rashid: I have a .mdb(acces file ).I want to open this mdb file by java programme .This means that whenever i run my java code with the path of mdb specified in the code, the mdb file should open up .Can any one help me out how to do this? Thanks Amin
You have to follow these steps. 1. Create a system data source name using the odbc administrator of the windows machine you are using. 2. Load the sun.jdbc.odbc.JdbcOdbcDriver class(Since we are using JDBC type 1 connection) 3. Get a conection to the database 4. Create a statement object 5. Fire an SQL to obtain a resultset 6. Browse thru the resultset to obtain data and do your processing 7. Close the connection
Can java open an MS Access database without Access being installed on a computer? The user will have to log in to my program with a password. I'm trying to figure out where the best place is to place the username and password. I thought I could place it into an Access database and then include that with the program when I distribute the program. I know a lot of people don't have Access. I didn't think a text file would be the best place for username and passwords. Any suggestions would be appreciated. Thanks
Yes, you can open an MS Access Database (*.mdb), without having Access itself installed on the computer. Remember, you're using JDBC to open the Database, which has nothing to do with Access. Even if you choose to use JDBC DBC to get to your Access database, you still don't need Access installed. Regards, Reuben Cleetus.
Joined: Jan 30, 2001
Thanks Reuben, I thought that would be the answer but I wasn't for sure. Thanks again, Matt
Joined: Sep 21, 2001
Actually what answer i was expecting when i started the thread is given below as the code.Actually i was not talking of making a conncetion to the access file but to open the access file as such from the directory itself..i was expecting this code which i got somewhere in the Forum itself....3 cheers for the forum Thank U all for the valuable contribution.