This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes SQL exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: SQL exception
 
Similar Threads
How to find the column names..???
Columns on JTable
Array index out of bounds exception
Its Very Urgent !!!! Help Me Now !!!!!!
EDITABLE JTable and SQL QUERY