This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Greetings, I have this little problem connecting the Java application I'm currently developing to a database on my PC. My PC's operation system is Windows 2000. And I have J2sdk1.4.0 installed. I'm trying to create what looks like a database which a bank would have. I created the database using Microsoft Access,it only contains a only one row presently..... The program was inspired by the Dietel and Dietel How to program book, 5th edition.
When the program is run, the error message I get is a error message dialog that says "No suitable driver" and titled Database Error. I have read all that's there to be read on the official Java tutorial on the JDBC database access. Especially, the page titled Establishing connection. It now appears I haven't configured my database correctly. But I've done all I think I should ..... I went to administrative tools,in control panel and clickinig on data sources and then the MSAccess database (which I think I made to appear there on the resulting tabbed pane applet ,somehow), and tried my best to configure the database (like the tutorial said I should), the best way I could intuitively. How can I get my program to work? The example in the book uses cloudscape, but I am trying to Use Microsoft access and I'm attemtping to modify the program to do so... Any useful suggestions would be greatly appreciated.
your database URL is incorrect andshould be separated by colons:
just wondering if you can run a non-jdbc program? Also, if you could cut and paste the exception message, that would help too. Jamie
Joined: Oct 28, 2003
Thanks so much for the answer Jamie Robertson I have corrected the error and still got the same message. The error message doesn't get displayed on the command prompt, and I had described what the little panel that gets displayed when I run the program says. The title of the little 'windows' is "Database error", and the message at the center of it is "No suitable driver", and an OK button just beneath it. Bimbo.
Joined: Oct 28, 2003
I've corrected the error... I thought I had when I put up the first post. The message I now got was "No data found". And the 'little window or panel' titled, "Database error". I think I've resolved the first problem, but a new one has cropped up now.. Can anyone figure out what I'm doing wrong?
Originally posted by Bimbo Adeniyi: I've corrected the error... I thought I had when I put up the first post. The message I now got was "No data found". And the 'little window or panel' titled, "Database error". I think I've resolved the first problem, but a new one has cropped up now.. Can anyone figure out what I'm doing wrong?
The only reason your error message is not printing out to the console is because you didn't code your exception routine to do it. Add the following line to this exception block:
this line will give you the error and the line that the exception occurred( you could identify this to us, since we can't see the line numbers in your code ). Cut and paste the stack trace here and we'll help you figure this one out. Jamie p.s. It has been my experience that JDBC DBC SQLException messages are bad at best and misleading at worst. So the best way to trouble shoot is to find the line that is causing you problems, and figure out why it is bombing out by looking at the code, not the error message.