File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes java.sql.SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "java.sql.SQLException" Watch "java.sql.SQLException" New topic


Krista Meek

Joined: Oct 24, 2005
Posts: 12

I am trying to connect to an Access database using the jdbc dbc bridge driver. When I run my database application I get the following error in the command line:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

My code is below. Are there any suggestions on what I need to add to, or remove from, the code, or how I should access/name the database in the DriverManager.getConnection("....")? Does anything special need to be done to the database? I defined the fields in the table, and named it appropriately. (It's Access 2000, if that makes a difference.) I realize that there's some debugging left to be done to the code with respects to variables and stuff, but I'd like to at least get a connection.


[ December 09, 2005: Message edited by: Krista Meek ]
[ December 09, 2005: Message edited by: Krista Meek ]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

You have to go into your Windows control panel and find the place where you configure ODBC. On my Windows XP system it's under Administrative Tools. Set up a user DSN based on Access with the name "Assign5".

However... it doesn't make sense to use an Access database from an applet. Everybody who used your applet would have to download the MDB file and do the same configuration. And you would need to deal with the security issues about how an applet isn't normally allowed to read and write on the local file system. So hopefully that "ChatApplet" isn't actually an applet.
I agree. Here's the link:
subject: java.sql.SQLException
It's not a secret anymore!