Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 16th, 2005, 07:50 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question in ResultSet.TYPE_FORWARD_ONLY

Hi All

I have written a sample code, which should throw an exception technically, but it is not, i have made line as bold, the code is

import java.sql.*;

public class SampleJDBC
{
  public static void main(String[] args) throws Exception
  {
    Class.forName("com.jnetdirect.jsql.JSQLDriver");
    Connection con = DriverManager.getConnection("jdbc:JSQLConnect://10.0.1.107","sa","sa");
    String str = "SELECT * FROM emp_ext";

    Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,Re sultSet.CONCUR_READ_ONLY);
    ResultSet rs = stmt.executeQuery(str);

    System.out.println("Fetch Direction : " + rs.getFetchDirection()); // prints 1000 which is ResultSet.FETCH_FORWARD
    System.out.println("Type : " + rs.getType()); // prints 1003 which is ResultSet.TYPE_FORWARD_ONLY

    System.out.println("============================== =============");
    while(rs.next())
    {
      System.out.println(rs.getString(1)+" : " +rs.getString(2)+" : "+rs.getString(3)+" : "+rs.getString(4)+" : "+rs.getString(5));
    }
    System.out.println("============================== =============");

rs.absolute(2); // It should throw an exception here right, since this is type forward only, but it is not.

    System.out.println(rs.getString(1)+" : " +rs.getString(2)+" : "+rs.getString(3)+" : "+rs.getString(4)+" : "+rs.getString(5));
    rs.absolute(1);
    System.out.println(rs.getString(1)+" : " +rs.getString(2)+" : "+rs.getString(3)+" : "+rs.getString(4)+" : "+rs.getString(5));

    con.close();
  }
}

So what is the problem here, These are the information about the versions etc,

Driver Information
Driver Name: NetDirect JSQLConnect
Driver Version: 2.2712

Database Information
Database Name: Microsoft SQL Server
Database Version: 8.0.760

Jdk Information
Java Version : java version "1.4.0"


  #2 (permalink)  
Old March 27th, 2005, 05:18 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Excuse me for this question:
I can't find the Professional java security code examples.

Can you help me?
Thank you

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I handle NULL resultset field? cm.cruz Classic ASP Basics 1 January 28th, 2008 06:29 PM
Having trouble splitting a list to a resultset? Peso SQL Server 2000 4 May 30th, 2006 10:58 AM
Resultset error madhucm JSP Basics 0 August 4th, 2005 12:08 PM
Find a particular data using ResultSet bamboat_45 Java Databases 2 August 5th, 2004 12:54 AM
Query Tables -- Resultset Paul O. Schenker Excel VBA 1 July 16th, 2003 04:32 AM



All times are GMT -4. The time now is 11:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.