DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Posts
    6

    Question Database connection problem

    I saw a way of database connection, looks like below. I don't understand it.

    //Databse Connection
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connect = DriverManager.getConnection("jdbc:odbc:MyDB");
    System.out.println("Connection Successful");
    Statement statement = connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    }catch(Exception e){
    System.out.println(e.toString());
    }

    Can someone explain to me that what is 'ResultSet.TYPE_SCROLL_SENSITIVE'?
    What does 'ResultSet.CONCUR_UPDATABLE' use for?

  2. #2
    Join Date
    Oct 2002
    Posts
    66
    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!
    Meethoss

  3. #3
    Join Date
    Nov 2002
    Posts
    59
    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
    http://java.sun.com/j2se/1.4.1/docs/...reateStatement(int, int)

    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.

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