Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2005, 07:50 AM
Registered User
 
Join Date: Feb 2005
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"


 
Old March 27th, 2005, 05:18 AM
Registered User
 
Join Date: Mar 2005
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






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.