I want to make connection to my database file of MS Access with my Java application but it is not being established even after i have followed up the book instructions. Could anybody guide me how could i do it easily or can suggest a tutorial or article which can help me to do so. Thanks in advance for your time and suggestion Raashed Ali
I've been able to do this successfully... what did the instructions in the book say?
Joined: Jan 16, 2001
Thanks for your reply. I am try to connect with my 'Book.mdb' file through the following code. I created the 'User DSN' connection of Book.mdb and it's appearing well in the list. Further, when I try to run the code it runs and shows the runtime error something like below on DOS but creates the GUI well as desired: "java.sql.SQLException: [...][Microsoft Access Driver Manager]Data source name or the established driver which is appointed are not found." something like this as far as i remember. Could anybody suggest me what i am mistaking in establishing the connection with my database. Thank you very much in advance for your help... Rashid Ali ==========
[This message has been edited by Rashid Ali (edited August 20, 2001).] [This message has been edited by Rashid Ali (edited August 21, 2001).]
can't tell what your url actually is due to the smilie face formatting, but you may be missing a colon. String sourceURL = "jdbc dbc:Books" ; NOPE! I just read mine after the formatting and it turned out the same! I don't use the smilies too much so I wasn't sure...eek ! , I guess I was a little confused . Jamie
[This message has been edited by Jamie Robertson (edited August 20, 2001).]
Thanks Jamie for your kind replies but the problem is still there... I have gone through the tutorial as suggested but i have set all the requirement of it and even it is not establishing the connection. Please look into the above example ??? Please help... Kind regards Rashid
Joined: Jul 17, 2001
I noticed you're trying to get the connection without using a username or password. What happens if you specify the username and password as arbitrary String fields?
Nathanael is problably right just try leaving the place for the username and password empty if you don�t have to autenticate this is a commom mistake try it like this: connection = DriverManager.getConnection( sourceURL,"","");
Your data source name is "Book.mdb", but you use "jdbc dbc:Books" in your DriverManager.getConnection(), remove "s" of "Books", it should work, otherwise you should check if your data source is created correctly. [This message has been edited by Ming_chen (edited August 22, 2001).]
Joined: Jan 16, 2001
Thank you all very very much for your kind help and suggestions. Actually the problem was that I was not giving the correct table name but was only providing the database name which caused that the connection could not establish due to the wrong table name and it did not work even though all the codes was okay and the file name was also ok but the table name was not Now it works fine and provide the desired results... Thank you very much again for participating and helping... Kind regards Rashid ali I LOVE JAVARANCH