Java: A platform for platforms
Sun's reorg may seem promising to shareholders but it's also a scramble for position. The question now is whether Sun can, or wants to, maintain its hold on Java technology. Especially with enterprise leaders like SpringSource and RedHat investing heavily in Java's future as a platform for platforms

Also see:

Discuss: Tim Bray on 'What Sun Should Do'

Featured Whitepapers
Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Server-side Java: Use JDBC for industrial-strength performance, Part 1

Java server-side data mining patterns made powerful with JDBC

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 4

Usage Scenario Description Diagram of Scenario
ResultSet CallableStatement scenario Create a CallableStatement from the open database Connection. Pass an SQL procedure call (executing a database stored procedure) to the CallableStatement and receive a ResultSet from the database.

ResultSet CallableStatement Scenario



Table 3. The hybrid ResultSet CallableStatement scenario



Although the ResultSet CallableStatement scenario seems simple enough to realize in Java code, the differences between databases and JDBC database drivers are now growing painfully visible to the developer. Despite the fact that JDBC is supposed to be mostly platform- and database-independent, the specifics of each database are visible not only when defining a stored procedure, but also when trying to return a ResultSet from one. Some database engines cannot return values from stored procedures; values that should be returned to the Java application must instead be declared as output parameters. Other databases may return only some kinds of types from a stored procedure call (generally INTEGER values to indicate the error code status of a procedure call). There are still other database types that might be able to return a full JDBC ResultSet equivalent (in some cases, this would correspond to a database CURSOR type), either as a result from a stored procedure call or as an output parameter. Depending on the capabilities of the stored procedure execution engine being called, different calling methods may be used, as described in the table below:

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.