DatabaseMetaData.getDatabaseProductName returns a string that identifies the
database manager and the operating system. The string has one of the following
formats:
database-productdatabase-product/operating-system
The following table shows examples of values that are returned by
DatabaseMetaData.getDatabaseProductName.
Table 3. Examples of DatabaseMetaData.getDatabaseProductName values
getDatabaseProductName value Database product
DB2 DB2 for z/OS
DB2/LINUXX8664 DB2 Database for Linux, UNIX, and Windows on Linux
on x86
IDS/UNIX64 IBM Informix Dynamic Server (IDS) on UNIX
DatabaseMetaData.getDatabaseVersionName returns a string that contains the
database product indicator and the version number, release number, and
maintenance level of the data source.
The following table shows examples of values that are returned by
DatabaseMetaData.getDatabaseProductVersion.
Table 4. Examples of DatabaseMetaData.getDatabaseProductVersion values
getDatabaseProductVersion value Database product version
DSN09015 DB2 for z/OS Version 9.1 in new-function mode
SQL09010 DB2 Database for Linux, UNIX, and Windows Version 9.1
IFX11100 IDS Version 11.10
Variables in JDBC applications
As in any other Java application, when you write JDBC applications, you declare
variables. In Java applications, those variables are known as Java identifiers.
Some of those identifiers have the same function as host variables in other
languages: they hold data that you pass to or retrieve from database tables.
Identifier empNo in the following code holds data that you retrieve from the
EMPNO table column, which has the CHAR data type.
String empNo;
// Execute a query and generate a ResultSet instance
rs = stmt.executeQuery("SELECT EMPNO FROM EMPLOYEE");
while (rs.next()) {
String empNo = rs.getString(1);
System.out.println("Employee number="+empNo);
}
Your choice of Java data types can affect performance because DB2 picks better
access paths when the data types of your Java variables map closely to the DB2
data types.
Related concepts
“Example of a simple JDBC application” on page 7
Related reference
“Data types that map to database data types in Java applications” on page 193
Chapter 3. JDBC application programming 23