DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    39

    sun.jdbc.odbc.JdbcOdbcResultSet@17fe066

    I am running the following sql statement and receiving this message in the browser:

    String find = "select employeeID, dependantID FROM dependant where dependantID = "+ dependantID +";";
    Statement stmt3 =con.createStatement();
    ResultSet res = stmt3.executeQuery(find);
    out.println(res);

    The variable dependantID is part of the resultSet of a previous SQL statement.
    Can anyone suggest how to solve this problem? I have already tried to run the query as:
    "select employeeID, dependantID FROM dependant where dependantID = "+rs.getInt("dependantID") +";";
    But I got the same error message.

    Regards,
    Maria

  2. #2
    Join Date
    Sep 2005
    Location
    istanbul / Turkey
    Posts
    133
    i guess, it was not an error message.
    your ResultSet object prints itself
    as an java object( like a memory adress )...

    you must to retrive data from ResultSet.
    http://java.sun.com/docs/books/tutor...etrieving.html

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560

    Just an idea..

    Are you using two resultsets at the same time ? If I try that it fails; the first
    resultset is being closed when the other resultset is being retrieved.
    The only way I get around that is to use two different java.sql.Statement
    objects, one for each of the two queries.

    I would be better of you posted the code that fails, and the exception
    you get. The snippet you have posted here doesn't tell the whole story.
    eschew obfuscation

  4. #4
    Join Date
    Oct 2005
    Posts
    40

    Thumbs up

    It the problem is what I am thinking than its very funny. Neverthless its the most commonly made mistake.

    1) Before retriving any data from the resultset do res.next() as pointer is placed at -1
    2) Do not print res by itself but get the data as res.getInt( 1 ). if you know the column name than do res.getInt( "colname" );

    Regards,
    Mohit

  5. #5
    Join Date
    Aug 2005
    Posts
    24
    > out.println(res)

    if she is using sockets, wouldn't she be getting an exception because ResultSet does not implement the Serializable Interface. We can not send a ResultSet object through a socket ( as far as i know ) ???

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links