Axion: Frequently Asked Questions
What versions of the JDK/JRE does Axion support?
Axion has been tested with JDK 1.1, JDK 1.2, JDK 1.3 and JDK 1.4.
It can run safely on PersonalJava/J2ME and other micro-platforms, as well
within an Applet or as an unsigned (sandboxed) Java Web Start application.
Note that the latest versions of Axion will only compile with JDK 1.4 or later,
although the generated binaries work with earlier JVMs.
What versions of the JDBC specification does Axion support?
Axion supports most of the JDBC 2 and JDBC 3 specifications.
How do I create an auto-number column?
Axion does not support Access style "auto-number" columns. Instead, Axion supports
a more robust "sequence" mechanism. (See What are sequences and how do I use them?
for more information on sequences.) You can create an auto-number column in Axion using
sequences and column defaults. Simply create a sequence:
create sequence my_sequence
and then add my_sequence.nextval as
the default value for your "auto-number" column:
create table my_table (
id integer default my_sequence.nextval,
value string
)
Now whenever you insert values into the table without specifying an id value,
the next sequence value will be inserted instead. For example,
insert into my_table values ( null, 'foo' )
or
insert into my_table ( value ) values ( 'foo' )
Within the same transaction, you can obtain the most recently generated value of the sequence
using my_sequence.currval. For example:
select my_sequence.currval
Note that column defaults are only supported in Milestone 3 or later. Under the Milstone 2 release,
you must specify the sequence "manually", for example:
insert into my_table values (my_sequence.nextval, 'foo' )
What are sequences and how do I use them?
A sequence is a special sort of database object that operates in many ways
like a table. A sequence maintains a integer valued counter that can be
incremented. To create a sequence, execute a SQL statement like the following:
create sequence my_sequence
or
create sequence my_sequence starts with 1234
The sequence object supports two types of "pseudo-columns", nextval and currval.
The nextval column will increment the sequence and return the resulting value. For example:
select my_sequence.nextval
This expression can be used wherever a literal value, function, column name, etc. can be used.
Note that you can increment a sequence multiple times in a single statement:
select my_sequence.nextval, my_sequence.nextval, my_sequence.nextval
Within the same transaction, you can obtain the most recently generated value of the sequence
using my_sequence.currval. For example:
select my_sequence.currval
Note that even when auto commit is true, each statement is executed within it's own
transaction, so you can use statements like:
select my_sequence.nextval, my_sequence.currval
no matter what the current transaction mode is.
Sequences can be dropped much like tables and other database objects:
drop sequence my_sequence
Note that support for the currval pseudo column is only available in the
Milestone 3 release or later.
Axion - Open Source Java Database Engine
$Id: faq.html,v 1.21 2007/11/15 15:09:27 rwald Exp $
Published 15 Nov 2007 at 3:07 PM GMT.