Chapter 7 SQL Data Types
291
v To install a class, using Sybase Central:
1 From Sybase Central, connect to the database as a user ID with DBA
permissions.
2 Open the Java Objects folder, and double-click Add Java Class or Jar.
Follow the instructions in the wizard to install the class.
v To install a class, using Interactive SQL:
1 From Interactive SQL, connect to the database as a user ID with DBA
permissions.
2 Enter the following command to install the class:
INSTALL JAVA NEW FROM
filename
$ For more information about installing classes, see the "INSTALL
statement" on page 556.
Case sensitivity of Java class data types
Java identifiers, including data types, are case sensitive: the Java int data
type cannot be written as INT. SQL identifiers, including data types, are case
insensitive. The int data type can also be written as Int or any other
combination of upper and lower case characters.
When a Java class is used as a SQL data type, the data type is always case
sensitive. This is an exception to the rule for SQL identifier case
insensitivity.
If you install a class named Demo, the following statements are not
equivalent:
CREATE TABLE t1 (
id INT PRIMARY KEY
demo_column Demo )
CREATE TABLE t1 (
id INT PRIMARY KEY
demo_column DEMO )
Using classes as data types
You can create a table with columns based on a Java class data type, just as
you can with any other data type. For example, if
MyClass
is a Java class
installed into the database, you can create a table using this class as follows:
CREATE TABLE mytable (
Example
Creating tables
using Java class
data types