DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Posts
    1

    JDBC updatable ResultSet help!

    Hi everyone. I'm using JDBC to write a class in Java that connects to a mySQL database (through the Connector/J driver). When I try to execute the code below it throws an exception that my ResultSet in not updatable. I understand that this might have to do with setting the Primary Key, etc. but I'm not sure how to do this in Java. Any help would be greatly appreciated!

    J. Ciolkosz

    try{
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    srs.absolute(position);
    element = srs.getString(field);
    }catch(SQLException ex){
    System.err.println("----SQLException----");
    System.err.println("SQLState: " + ex.getSQLState());
    System.err.println("Message: " + ex.getMessage());
    System.err.println("Vendor: " + ex.getErrorCode());}

  2. #2
    Join Date
    Nov 2002
    Posts
    59
    I'm guessing that srs is your ResultSet, here...the problem probably lies in this: Don't forget to do an executeQuery before trying to use a ResultSet. For example

    srs = stmt.executeQuery("select........");

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