Java Reference
In-Depth Information
types. These are discussed in the next few paragraphs.
Some databases allow for certain columns to be given automatically generated key
values. In this case, an insert statement is not responsible for supplying a value for
the column. The database generates a unique value for the column and inserts the
value. This is often used for generating unique primary keys. A problem with this
approach is that it may be difficult to get the value after the insert is executed. The
JDBC 3.0 specification defines a more functional Statement interface that provides
access to these values after an insert.
Assume a table called USERS with three columns. The FIRST_NAME column and
LAST_NAME column are varchars. The USER_ID column is auto-generated and
should contain a unique identifier for each user in the table. Here's an example:
Statement stmt = conn.createStatement();
String SQLInsert = "INSERT INTO Users (First_Name, Last_Name) "+
"VALUES('Robert', 'Conners')");
stmt.executeUpdate(SQLInsert);
ResultSet rs = stmt.getGeneratedKeys();
SQL3 Data Types
The JDBC 2.0 Extension API adds support for the new data types commonly referred
to as SQL3 types. The JDBC 3.0 Extension API extends this support. These new data
types support the two following major new features:
 
Very large data objects
 
Object relational data types
The SQL3 data types are being adopted in the next version of the ANSI/ISO SQL
standard. The JDBC API extensions provide interfaces that represent the mapping of
these SQL3 data types into the Java programming language. With these new
interfaces, you can work with SQL3 data types the same way you do other data
types.
Object Relational Databases
Object relational databases are simply an extension to normal relational database
management systems supporting the use of an object-oriented-design approach to
the database world.
For example, in a normal RDBMS, you might create a table of names and addresses,
containing these columns:
Search WWH ::




Custom Search