• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1016
  • Last Modified:

SQL server JDBC driver don't support resultset.last()?

Hello everyone,

HELP! HELP!
I connect SQLServer via ms jdbc driver. In my jsp application, i want to perform paging.
But, it is don't support resultset.last()?
When i try this, there is an exception. How can I solve the problem?

Paul
0
hkpaul
Asked:
hkpaul
  • 3
  • 2
1 Solution
 
arbertCommented:
This functionality works for me as long as you have beta2 of the driver or higher also make sure that you are checking the result set before calling last() method;

Here is the sample code for that;


if(con!=null){
 Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
 ResultSet rs = stmt.executeQuery("select * from update_test");
                   if(rs!=null){
     rs.last();
 System.out.println(rs.getInt("id"));
}else System.out.println("No Active Connection");
0
 
hkpaulAuthor Commented:
thank you for your help.

My driver version is
MS SQL Server 2000 Driver for JDBC - Service Pack 1
and i also tried to create a scrollable resultset
it still get the exception....

javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.last
     at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
     at org.apache.jsp.ad_0005fupdate_0005fmember$jsp._jspService(ad_0005fupdate_0005fmember$jsp.java:256)

...........
0
 
hkpaulAuthor Commented:
also my configuration is:

tomcat, SQL Server 2000

and i put [msutil.jar, mssqlserver.jar, and msbase.jar] at
tomcat/common/lib
0
 
arbertCommented:
Can you show me the code where you decleare resultset and where you actually call ResultSet.last?

Thanks
Brett
0
 
hkpaulAuthor Commented:
Thank you, I think i know what happen :)
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now