This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

JDBC  RSS feed

Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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";
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.
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 promise I will be the best, most loyal friend ever! All for this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!