SQL server ResultSet is Read only

   //stmt = cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

      stmt = cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

 

解决办法

TYPE_SCROLL_INSENSITIVE改为 TYPE_SCROLL_SENSITIVE 

 

或者不要使用jtds 驱动

 

jtds 好像可以解决 2000 数据库转到 2005的差异性!

 

public static Connection getConn()throws ClassNotFoundException, SQLException{

long start=System.currentTimeMillis();

Connection conn=null;

//com.microsoft.sqlserver.jdbc.SQLServerDriver

//Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");//2000 jar驱动

//Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//2005驱动

Class.forName("net.sourceforge.jtds.jdbc.Driver"); jtds驱动 代替sqlserver驱动

     String constr;  

     //constr="jdbc:sqlserver://localhost:3803;databaseName=CDCA_SAS_CCLAND;SelectMethod=cursor"; //2005

     //constr="jdbc:microsoft:sqlserver://localhost:3803;DatabaseName=CDCA_SAS_CCLAND;SelectMethod=cursor;";//2000

     constr="jdbc:jtds:sqlserver://localhost:3803/CDCA_SAS_CCLAND";

     //String url="jdbc:jtds:sqlserver://localhost:1433/pubs";

     conn=DriverManager.getConnection(constr,"sa","123456");

     long end=System.currentTimeMillis();

     System.out.println("kangkang");

     return conn;

}

 

你可能感兴趣的:(sql,.net,SQL Server,jdbc,Microsoft)