?
Solved

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

Posted on 2003-03-22
5
Medium Priority
?
994 Views
Last Modified: 2011-04-14
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
Comment
Question by:hkpaul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 34

Accepted Solution

by:
arbert earned 225 total points
ID: 8187154
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
 

Author Comment

by:hkpaul
ID: 8187338
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
 

Author Comment

by:hkpaul
ID: 8187343
also my configuration is:

tomcat, SQL Server 2000

and i put [msutil.jar, mssqlserver.jar, and msbase.jar] at
tomcat/common/lib
0
 
LVL 34

Expert Comment

by:arbert
ID: 8187369
Can you show me the code where you decleare resultset and where you actually call ResultSet.last?

Thanks
Brett
0
 

Author Comment

by:hkpaul
ID: 8189038
Thank you, I think i know what happen :)
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question