This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC" Watch "JDBC" New topic
Author

JDBC

Richard Robbins
Ranch Hand

Joined: Mar 07, 2001
Posts: 66
I have created an Access database file called ReceiveProcessTest.mdb with a table called Employees. I am testing querying the table, but I am having trouble. Here is my code:

String data = "jdbc dbc eluxeCD";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection receiveQueueConnection = DriverManager.getConnection(data, "", "");
Statement writeToQueue = receiveQueueConnection.createStatement();
ResultSet receiveRec = writeToQueue.executeQuery("SELECT LastName FROM " +
"ReceiveProcessTest.mdb Employees WHERE FirstName LIKE Richard");
An exception keeps being thrown with this message:

Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] The Micr
osoft Jet database engine cannot find the input table or query 'mdb'. Make sure
it exists and that its name is spelled correctly.

The Data Source administrator shows that there are two "User DSN" drivers installed: DeluxeCD and MS Access Database.
If anyone has any solution to this error, please let me know.
Thanks,
Richard


Richard Robbins is one of the founders of WebsiteTemplateDatabase.com, a resource for free website templates and Photoshop tutorials. He also consults for an online boutique selling baptism dresses and christening gowns.
Terry McKee
Ranch Hand

Joined: Sep 29, 2000
Posts: 173
Just a simple change in your sql statement will get rid of the error. You have the following:
SELECT LastName FROM ReceiveProcessTest.mdb Employees WHERE FirstName LIKE Richard"
You don't need to mention the database name since the jdbc dbc Url already defines it. Also I believe the LIKE argument needs single quotes around it. Change the sql statement to the following:
"SELECT LastName From Employees WHERE FirstName Like 'Richard'"
Hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC
 
Similar Threads
Invalid Object Name
Data Type Mappings
help wanted
dynamic creation of Data Source Name(DSN) programatically , help needed urgent
JDBC and MS Access