Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC-ODBC with Access : Error in Execution

 
Ratheesh Narayanan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an application which needs to be connected MS Access Database and fetch the information. I am using JDBC-ODBC Driver for that.

I have a Prepared Statement like below:
update product1 set DescriptionOne='20$ Off on next purchase' where ProductCode='0001'

When I am executing the statement I am getting an error mentioned below:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

If anyone came across the same error please let me know...

Thanks,

Ratheesh
 
Ratheesh Narayanan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I myself found a solution for this issue..

The problem is: whenever you execute a query against a table where a column name is space seperated you will face this problem.

So put the column names in a square brackets and execute; the query will be executed successfully.

Ratheesh
 
mani senthil
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SEND ME THE STRUCTURE OF THE DB AND THE PROGRAME
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ratheesh,
Thanks for posting the solution so that others who see this thread in the future can benefit.

Mani,
Note that writing in all caps either implies that you are shouting or that your keyboard is broken with the caps lock key down.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic