OK.. I have downloaded a jdbc driver from MS. version 1.4.
I create a statement as
con.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
when I try to execute updateRow(), I get an exception saying the cursor is not updatable.
IF I use ResultSet.Type_FORWARD_ONLY, however, I can update.
Why?
thanks
Here is the test code, such as it is.
public static void main(String[] args) {
int i;
SQLWarning sqlwarning;
String url;
try {
Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}
catch (Exception e){
i = 0;
}
url = "jdbc:sqlserver://servername;";
try {
Connection con = DriverManager.getConnection(url,user,password);
Statement stmt =
con.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = stmt.executeQuery("SELECT c1,c2,c3 FROM table where id='x'");
sqlwarning= uprs.getWarnings();
uprs.next();
uprs.updateString("c3", "beta");
uprs.updateRow();
}
catch (SQLException se){
i=0;
}
}
I create a statement as
con.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
when I try to execute updateRow(), I get an exception saying the cursor is not updatable.
IF I use ResultSet.Type_FORWARD_ONLY, however, I can update.
Why?
thanks
Here is the test code, such as it is.
public static void main(String[] args) {
int i;
SQLWarning sqlwarning;
String url;
try {
Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}
catch (Exception e){
i = 0;
}
url = "jdbc:sqlserver://servername;";
try {
Connection con = DriverManager.getConnection(url,user,password);
Statement stmt =
con.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = stmt.executeQuery("SELECT c1,c2,c3 FROM table where id='x'");
sqlwarning= uprs.getWarnings();
uprs.next();
uprs.updateString("c3", "beta");
uprs.updateRow();
}
catch (SQLException se){
i=0;
}
}