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!
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
element = srs.getString(field);
System.err.println("SQLState: " + ex.getSQLState());
System.err.println("Message: " + ex.getMessage());
System.err.println("Vendor: " + ex.getErrorCode());}
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........");
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