Database connection problem
I saw a way of database connection, looks like below. I don't understand it.
Connection connect = DriverManager.getConnection("jdbc:odbc:MyDB");
Statement statement = connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
Can someone explain to me that what is 'ResultSet.TYPE_SCROLL_SENSITIVE'?
What does 'ResultSet.CONCUR_UPDATABLE' use for?
This is a total guess: I recon it must mean "update concurrently", i.e. it will allow you to update things at the same time. Hope that's helped - nobody else seems to be answering questions around here!
Those are both constants of the ResultSet class. see http://java.sun.com/j2se/1.4.1/docs/...ResultSet.html
Also, the createStatement can take two integers. See
They're not really needed to create a statement...you can just use connection.createStatement() instead...I'm not entirely sure what they do, but I've never used them. TYPE_FORWARD_ONLY and CONCUR_READ_ONLY are the defaults, and they've worked great for me.
I'm pretty sure that TYPE_FORWARD_ONLY verses TYPE_SCROLL_INSENSITIVE is that you can only move forward in the result set, as opposed to being allowed to move backwards. The TYPE_SCROLL_INSENSITIVE verses TYPE_SCROLL_SENSITIVE is that the sensitive does change the original data, while insensitive doesn't...though I question that. CONCUR_READ_ONLY means that it can't be updated, while CONCUR_UPDATABLE means that the resultset can be updated. Hope this helps a little.
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