Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL exception

 
Vladimir Kositsky
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i am trying to update MS Access database from JTable while editing in cell, so setValueAt() overriden as shows below.
First update it works , but on second following exception appears:

[Microsoft][ODBC Microsoft Access Driver]Prepared statement not a cursor-specification
<code>
public void setValueAt(Object value, int row, int column) {
String query = null;
try {
String tableName = metaData.getTableName(column+1);
if (tableName == null) {
System.out.println("Table name returned null.");
}
String columnName = getColumnName(column);
query =
"update "+ "EMPLOYEES_7"+
" set "+columnName+" = "+dbRepresentation(column, value)+
" where inx = " + row;
System.out.println(query);
querry = null;
statement.executeUpdate(query);
}
catch (SQLException e) {
System.err.println(e.getMessage());
System.err.println("Update failed");
}
Vector dataRow = (Vector)rows.elementAt(row);
dataRow.setElementAt(value, column);
}
<\code>
Please help
V
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

check out this discussion where it says that MS Access
doesn't support prepared stmts.
http://www.javaranch.com/ubb/Forum3/HTML/000055.html
regds.
- satya
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just Use rs.next() to remove an exception.
Anurag
SCJP,SCJD,IBM Cert, MS-IT, MBA-IT
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic