File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQL exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL exception" Watch "SQL exception" New topic
Author

SQL exception

Vladimir Kositsky
Ranch Hand

Joined: Nov 03, 2000
Posts: 116
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

Joined: Jun 03, 2000
Posts: 5040

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

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
Just Use rs.next() to remove an exception.
Anurag
SCJP,SCJD,IBM Cert, MS-IT, MBA-IT
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL exception