在数据库中使用 Java
§ CREATE 表 jdba.customer
(
id integer NOT NULL,
company_name CHAR(35) NOT NULL,
JName Adaptive Server Anywheredemo.Name NOT NULL, JContactInfo Adaptive Server Anywheredemo.ContactInfo NOT NULL, PRIMARY KEY (id))
限定Java Fields(字段)
§ 使用方法来选取列Jprod 中的一个字段
SELECT Jprod.getDescription( ) FROM product
§利用指定字段名来选取列Jprod 中的一个字段
SELECT Jprod.description FROM product
插入 Java 列
§利用缺省constructor 插入Java 对象
§ INSERT INTO product (ID, Jprod) VALUES (702, NEW Adaptive Server Anywheredemo.Product( ))
插入Java 列
§利用把所有的参数都传送给constructor来插入Java 对象
§ insert into product_item(id,JProd) •values (704, NEW Adaptive Server Anywheredemo.Product('Yellow','tee-shirt with picture of GG bridge', 'SF tee shirt',50,'Big',19.99))