Article Discussion
Upcoming Features in JDBC 4
Summary: JDBC 4 is the forthcoming release of the Java Database Connectivity API. Currently in Early Draft Review in the JCP (JSR 221), JDBC 4 is a major new release with a strong focus on ease-of-use and programmer productivity. The new JDBC version also introduces support for SQL 2003 data types, including SQL's native XML type. This article surveys the key JDBC 4 features.
8 posts.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: August 17, 2006 11:39 PM by joe
    Bill
     
    Posts: 409 / Nickname: bv / Registered: January 17, 2002 4:28 PM
    Upcoming Features in JDBC 4
    September 2, 2005 6:00 PM      
    JDBC 4 is the forthcoming release of the Java Database Connectivity API. Currently in Early Draft Review in the JCP (JSR 221), JDBC 4 is a major new release with a strong focus on ease-of-use and programmer productivity, and support for SQL 2003 data types, including SQL's native XML type. This article surveys the key JDBC 4 features.

    http://www.artima.com/lejava/articles/jdbc_four.html

    What do you think of the new JDBC 4 features?
    • Vic
       
      Posts: 1 / Nickname: netsql2 / Registered: September 4, 2005 10:49 PM
      Re: Upcoming Features in JDBC 4
      September 5, 2005 2:52 AM      
      Interesting.

      Is any vendor planing to do a JDBC 4 driver?

      .V
      • Frank
         
        Posts: 135 / Nickname: fsommers / Registered: January 19, 2002 7:24 AM
        Re: Upcoming Features in JDBC 4
        September 6, 2005 7:12 AM      
        JDBC 4 is still in early draft review, which means it isn't a fully released standard yet. In fact, you are free to download the spec and comment on it, if you're interested. Once it becomes a fully approved JSR, vendors will no doubt start implementing JDBC4 - compliant drivers.
    • Harri
       
      Posts: 1 / Nickname: fuerte / Registered: September 6, 2005 5:06 AM
      Re: Upcoming Features in JDBC 4
      September 6, 2005 9:11 AM      
      Do we finally get multi-line (verbatim) string literals? Where you can't have escape sequences. Like the following:

      Connection c = myDataSource.getConnection();
      PreparedStatement st = c.prepareStatement("""
      insert into siteusers (userid, username)
      values (?, ?)
      """;
      st.setRowId(1, rowId1);

      Here """ would mean that start of the string is in the next line, so that the beginning of the string would be properly intended. Here the resulting string would be:

      insert into siteusers (userid, username)\nvalues (?, ?)
      • Brian
         
        Posts: 1 / Nickname: briansbc / Registered: September 23, 2005 10:14 AM
        Re: Upcoming Features in JDBC 4
        September 23, 2005 2:17 PM      
        I doubt it since this has nothing to do with JDBC. But, if you want that feature, check out Groovy: http://groovy.codehaus.org/Strings
    • Javid
       
      Posts: 3 / Nickname: javidjamae / Registered: January 31, 2003 0:23 PM
      Re: Upcoming Features in JDBC 4
      September 27, 2005 10:28 AM      
      In the Type-safe querying and results code that you show, you never describe how the actual binding happens.

      How does the system decide that when it runs the query defined in the annotation that it is going to create a DataSet of User objects? How does it know that each row of the query is going to be mapped into a User object and what fields on the database are to be mapped to each field on the object?

      The fields may be associated by naming convention, but there seems to be something missing from the example that binds the User object to the user table.

      interface MyQueries extends BaseQuery {
       
      	@Query(sql="select * from user")
      	DataSet getAllUsers();
      }
       
      .
      .
      .
       
      Connection c = myDataSource.getConnection();
      MyQueries myQueries = c.createQueryObject(MyQuery.class);
      DataSet users = myQueries.getAllUsers();
      for (User u: users) {
      	System.out.println("User's name is: " + user.name;
      }
      
      • Mathieu
         
        Posts: 1 / Nickname: patate / Registered: October 18, 2005 5:04 PM
        Re: Upcoming Features in JDBC 4
        October 18, 2005 9:12 PM      
        > The fields may be associated by naming convention, but
        > there seems to be something missing from the example that
        > binds the User object to the user table.

        From the JDBC4.0 spec pdf:

        [...]
        public class Mammal {
        public String firstName;
        public String lastName;
        public int age;
        public int weight;
        public String description;
        }
        [...]
        Methods decorated by Select annotations will return instances of DataSet<T>.

        interface MyQueries extends BaseQuery {
        @Select(sql="SELECT lastName, description FROM mammal")
        DataSet<Mammal> getAllMammals();
        [...]

        DataSet<T> is your answer.
    • Josh
       
      Posts: 1 / Nickname: firefight / Registered: June 16, 2006 2:47 PM
      Re: Upcoming Features in JDBC 4
      June 16, 2006 6:53 PM      
      I'm literally drooling about the new JDBC 4 features. I almost wet my pants when I saw the Type Safe DataSets. I can't wait to be able to use this in production. Way Cool!!
      • joe
         
        Posts: 2 / Nickname: jetbrains / Registered: January 29, 2006 7:59 PM
        Re: Upcoming Features in JDBC 4
        August 17, 2006 11:39 PM      
        JDBC 4.0 Enhancements in Java SE 6.
        Auto-loading Driver is good feature.
        In JDBC 4.0, we don't need the Class.forName() line.
        http://www.developerzone.biz/