Hi. I receive the SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC]Can not update, the specified column is not writable.
when I attempt to call updateString() on a RecordSet column. I have set the Statement object on which I execute the query to obtain the RecordSet to be scrollable and updatable.
My goal is to replace the ID value contained in a particular column of each row with a longer text string that includes the ID value. If I can't alter the column values via the RecordSet, can I write SQL as part of the query to generate the text string?
Thank you.
RajCan You write a little example: what You have and what You want...
And your table's structure... if it is possible. and sqlsrv version.|||Hi. We run SQL Server 2000. I call the code that creates the Statement, executes the ResultSet, and outputs the results in separate methods, so here I include a summary of the code.
Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_I NSENSITIVE, ResultSet.CONCUR_UPDATABLE);
...
rs = statement.executeQuery(queryString);
...
WriteEditSCRLinks(rs);
Here's the definition of WriteEditSCRLinks().
//Replaces each SCR ID with a hyperlink that opens the edit SCR page on the ID.
//Method needs to input an updatable, scrollable RecordSet.
void WriteEditSCRLinks(ResultSet rs) throws SQLException
{
String FieldName = "SCRID";
while (rs.next())
{
String IDValue = rs.getString(FieldName);
String UpdateString = "<A HREF=\"" + SiteConfigHelper.getEditSoftwareChangeRequestURL() + "?" + FieldName + "=" + IDValue + "\">" + IDValue + "</A>";
rs.updateString(FieldName, UpdateString);
}
//Need to move the cursor to the position before the first row
//so as not to break GraphingHelper methods.
rs.beforeFirst();
}
Since someone told me that the JDBC object model does not intend for me to alter the ResultSet if I shall not alter the database, I have to solve this problem in a different way anyway. However, I would appreciate knowing whether the concept of updating the ResultSet differs from the concept of writing to a column.
Thank you.
Raj
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment