Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Exclamation Result set not returning values

    hi all,
    i have a paculiar prob in my code..

    i have a method that has the DB connection param.. connects to the DB.. retrieves data and sends it across..

    All connection parameters are correct
    Data is available in the table
    Data is retrieved when the statement is run on DB client pl sql editor.

    but rs.next() returns false

    what could be the issue ???

    below is the code..

    public void getEventKeys() {
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // This is format for below string
    // jdbc:oracle:thin:@//host:port/service
    String url = "jdbc:oracle:thin:@//cola094-vip:1521/XRDEV";
    // username: scott
    // password: tiger
    Connection conn = DriverManager.getConnection(url,"scott", "tiger");
    conn.setAutoCommit(true);
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select my_key from my_trigger");
    while (rset.next()) {
    System.out.println ("There is data!");
    }
    stmt.close();
    }
    catch (Exception e) {
    System.out.println (e.getMessage());
    }

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Does your code throw an exception?

    If the query executes without exception it can only be assumed that "my_trigger" contains no rows. You might want to check that it has rows first.

    Edit: you might want to put in a message somewhere in getEventKeys() to verify that you are actually making the call to that method.
    Last edited by mrmatt1111; 10-07-2009 at 02:01 AM.
    My Hobby Project: LegacyClone

  3. #3
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Default

    i ran the code in debug mode.. everything seems fine.. only thing is that the resultset.next is not returning true.. and yes data is there in thaat table...

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Well, there's nothing wrong with that code (other than the fact that you are not closing the resultset or the connection, and that, as well as the statement close, should be taking place in a finally block).

    So, when you check that the "table exists" and "has rows", are you using the same user and password you are there (different users have different rights) and are you connecting to the same IP, port, and SID. Stupid questions, but they need to be asked because the Orcale driver does not simply ignore them.

    If the answers to those questions are yes, then find an Oracle DB forum, as the problem is with the Driver and not with either Java or JDBC.

  5. #5
    netrista is offline Member
    Join Date
    Aug 2007
    Posts
    4
    Rep Power
    0

    Default

    Do you have the ability to perform comparative tests with a 3rd-party JDBC driver? If not, can you enable JDBC tracing against your current JDBC driver to determine why the rs.next() function call is failing?

    Best regards,
    Netrista Khatam
    Tech Services Manager
    OpenLink Product Support

  6. #6
    ganapathyvj is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default

    Hi Karthikeyan

    Were you able to resolve this issue at all? I've the exact problem and don't know where the problem lies.

    Thanks
    Ganapathy

Similar Threads

  1. problem on returning values..
    By kulangotski in forum Advanced Java
    Replies: 11
    Last Post: 03-07-2009, 02:13 AM
  2. Replies: 3
    Last Post: 12-10-2008, 01:38 AM
  3. Replies: 11
    Last Post: 12-08-2008, 12:29 AM
  4. Replies: 0
    Last Post: 05-22-2008, 10:53 AM
  5. Replies: 0
    Last Post: 11-30-2007, 11:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •