my dog learned polymorphism*
The moose likes JDBC and the fly likes Error trying to connect MS Acess 12 database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error trying to connect MS Acess 12 database" Watch "Error trying to connect MS Acess 12 database" New topic
Author

Error trying to connect MS Acess 12 database

Sridhar Venkataraman
Ranch Hand

Joined: May 22, 2006
Posts: 76
Hello all,

I'm using the Microsoft Office 12 beta release from Microsoft.

Using the Administration Tool for ODBC Data Sources in the Control Panel, I created a DSN to connect a brand new database to store messages to my web application, which is a message board (duh!). (The DSN created was a user DSN).

However, when I run my application using Apache Tomcat, I get the following exception :

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I have cross checked my connection string and it's perfectly fine (matching DSN name, username and password).

I used the Microsoft Access Driver (.mdb) in the ODBC Data Sources Administration Tool [Control Panel>Administrative Tools>Data Sources (ODBC)] in my first attempt to hook up the database with a DSN name.
I then used the Microsoft Access 12 Driver (.mdb, .accdb), but still to no avail.

When I clicked on the "Advanced" tab while setting up the DSN, I found that the Driver field (which comes under the fields used to set a username and password for the database) was indeed blank. Could this have anything to do with the exception or is it just that Microsoft Access 12 is not supported by the current JDBC version?

Thank you to anyone who helps with this in advance. Appreciate it...
Sridhar Venkataraman
Ranch Hand

Joined: May 22, 2006
Posts: 76
Well, here's yet another case of the problem being solved before anybody actually got to it! I used System DSN to set my DSN, and it worked!

But now I have another problem : An Invalid cursor exception

The source code of my message board application is HERE

Before you run the application, please ensure that the tables are created by running the CreateMessageBoardTables class file.

Please locate the : MsgBrdv1\WEB-INF\data folder and place an MS Access database there. Also name the DSN messageBoardDB, with the username : myUsername and Password : myPassword (that's how I've set the connection string, feel free to modify it if you like to )

If all goes well, you should be able to run the application. While you can register users and post/delete messages, you cannot view message threads because of the Invalid cursor exception.

Somebody please work around this...I've over it

A thousand thanks again!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18155
    
    8

I think it is far too demanding to ask somebody to download your entire application, configure it, and run it. I for one am not going to do that. A better way to approach the problem would be to write a small application that tries to read an Access database. Shouldn't be more than 50 lines of code. Then post it here together with a description of the problem -- exact error messages, line of code that threw exception, and so on.
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
As Paul suggested you write simple code to test the connection with the database.

You can try this..

print your connection object first by sop. If its null, it mean there is some problem in the connection.

If you are geting connection object ands still getting SQL exception at runtime then problem could be with the structure of table.


Naseem


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Sridhar Venkataraman
Ranch Hand

Joined: May 22, 2006
Posts: 76
Thanks for looking into this. My application isn't daunting at all for a fairly experienced Java professional...on the contrary, I think you'd find it quite amateurish

I will try out the suggestions provided in any case and see if it solves the problem. I have no issues in writing user information to the database, but the program fails when it tries to retrieve threads.
Sridhar Venkataraman
Ranch Hand

Joined: May 22, 2006
Posts: 76
My apologies for being ambiguous : by "thread" I meant a forum thread, not the conventional Java thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error trying to connect MS Acess 12 database
 
Similar Threads
Connecting to Access
Connecting to MS Access 2000
newbie help: Database server
DSN less MS access Connection using JSP - help needed
java.sql.SQLException[ODBC Driver Manager]Data source name not found and no default driver specified