O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving Column Values

Many of the examples up to this point use the getString() method to turn a column value into a Java data type. As one might expect, getString() returns the contents of the column in the result set as a character string. There are a number of these methods, but before discussing the purpose of getX() methods, some understanding of SQL and Java data types is required.

Most SQL data types have a corresponding Java data type, and the following table lists all of the types available in Apache Derby, as well as the corresponding getX() methods associated with their retrieval.

Table 9-4. SQL versus Java Data Types
SQL Data TypeJava.sql.TypesgetX() Method
SMALLINTSMALLINTgetShort()
INTEGERINTEGERgetInt()
BIGINTBIGINTgetLong()
DECIMAL ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required