This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Need help compiling libgcj on Solaris for benchmark


So replace "JDBC" with "most drivers implementing JDBC".  Furthermore I
was talking mostly about type 4 (pure Java) drivers, which are the ones
most gcj users would be interested in.

Some of JDBC's overhead is directly attributable to the API.  For
example, look at a typical ResultSet loop:

  ResultSet rs = statement.executeQuery("select id, name from
customer");

  while (rs.next()) {
    System.out.println(rs.getInt(1));
    System.out.println(rs.getString(2));
  }

The ResultSet object must allocate a new String for each row.  Compare
that to an embedded C/SQL equivalent:

  int id;
  char name[20];

  $declare c1 cursor for select id, name from customer;
  $open c1;
  while (1) {
    $fetch c1 into $id, $name;
    if (sqlca.sqlcode == NOTFOUND) break;
    printf("%d", id);
    printf("%s", name);
  }

Here the string buffer is allocated once.  JDBC however provides no
method to retrieve CHAR/VARCHAR results without allocating a new String
object.  Consequently, object allocation is a big factor in JDBC
performance.

Olivier.Lefevre@wdr.com wrote:
> 
>      JDBC is just a high-level API; there are many types of drivers
>      implementing it, so I don't see how the blanket statement below could
>      be true.
> 
>      -- O.L.

-- 
Jeff Sturm
jsturm@sigma6.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]