wood burning stoves 2.0*
The moose likes JDBC and the fly likes JDBC-ODBC with Access : Error in Execution 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-ODBC with Access : Error in Execution" Watch "JDBC-ODBC with Access : Error in Execution" New topic
Author

JDBC-ODBC with Access : Error in Execution

Ratheesh Narayanan
Ranch Hand

Joined: Oct 30, 2004
Posts: 38
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


SCJP 1.4 & SCBCD 1.5
Ratheesh Narayanan
Ranch Hand

Joined: Oct 30, 2004
Posts: 38
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

Joined: Jan 18, 2007
Posts: 17
SEND ME THE STRUCTURE OF THE DB AND THE PROGRAME
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC-ODBC with Access : Error in Execution
 
Similar Threads
Servlet - JDBC interaction
DATABASE APPLET
Driver
JDBC & Servlet
Error in insert into