Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Novice in JDBC

 
Rashid Ali
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nathanael Ulrick
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been able to do this successfully... what did the instructions in the book say?
 
Rashid Ali
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tutorial from sun: http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html
Jamie
 
Rashid Ali
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nathanael Ulrick
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,"","");
 
Ming_chen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Rashid Ali
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic