Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger


Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers
I'm not able to update the database
i don't know why it is showing the error like this

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.

here is the code below

<title>Updating User information

<%@ page language="java" session="true" import="java.sql.*" %>


String name = request.getParameter("name");
String toupd = request.getParameter("name1");
String desig = request.getParameter("desig");
String comp = request.getParameter("comp");
String addr = request.getParameter("addr");
String ph = request.getParameter("ph");
String mob = request.getParameter("mob");
String fax = request.getParameter("fax");
String email = request.getParameter("email");
String email1 = request.getParameter("email1");
String aname = request.getParameter("aname");
String amob = request.getParameter("amob");
String aemail = request.getParameter("aemail");
String plot = request.getParameter("plot");
String city = request.getParameter("city");
String place = request.getParameter("place");
String country = request.getParameter("country");
String d = request.getParameter("descr");


catch(ClassNotFoundException e)

String dbURL = "jdbc dbc:address";

Connection dbCon;

dbCon = DriverManager.getConnection(dbURL);

PreparedStatement ps = dbCon.prepareStatement("UPDATE addr SET name =?,desig=?,comp=?,plot=? ,city=? ,place=? ,country=? ,ph=? ,mob=? ,fax=? ,email=? ,email1=? ,aname=?, aemail=? ,amob=?, d=? where name="+"'"+toupd+"'");

ps.setString(1, name);
ps.setString(2, desig);
ps.setString(3, comp);
ps.setString(4, plot);
ps.setString(5, city);
ps.setString(6, place);
ps.setString(7, country);
ps.setString(8, ph);
ps.setString(9, mob);
ps.setString(10, fax);
ps.setString(11, email);
ps.setString(12, email1);
ps.setString(13, aname);
ps.setString(14, amob);
ps.setString(15, aemail);
//ps.setString(16, relation);
ps.setString(16, d);
int x = ps.executeUpdate();

out.println("Updated Successfully");
catch(SQLException e)
{out.println("address book error" +e);




any one please help me..


Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey check the Database and see if there is write permissions for that Database.
For writing into .mdb, u need to have write permissions for that database.
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not write protected..

i can insert datas in to the table..
i can read
but i cannot update..

i think the program is correct

is any other problem is this
Sri Ram
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if the readOnly property is set in your DSN.
try placing this tag in ur code.

Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd try just using ps.execute() instead of ps.executeUpdate() and see what happens. Another thing to try is to introduce another bind item for:

just in case that string concatenation is something causing you to end up with something unparseable.
[ February 15, 2006: Message edited by: Reid M. Pinchback ]
We're being followed by intergalactic spies! Quick! Take this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic