Search This Blog

Sunday, November 14, 2010

Apache DerbyDB

DB is a Project of the Apache Software Foundation, charged with the creation and maintenance of commercial-quality, open-source, database solutions based on software licensed to the Foundation, for distribution at no charge to the public.

I got the chance to test it and play with it,, as embedded db in my app.
i wrote some notes so i would like to share with you.
to start the db:
cd D:\MyStuff\R_and_D\DerbyDB\db-derby-10.6.2.1-bin\DERBYTUTOR
set DERBY_HOME=D:\MyStuff\R_and_D\DerbyDB\db-derby-10.6.2.1-bin
set PATH=%DERBY_HOME%\bin;%PATH%
setEmbeddedCP.bat
java -jar %DERBY_HOME%\lib\derbyrun.jar ij
CONNECT 'jdbc:derby:mydb;create=true';

running script
run 'cmd.sql';
disconnect
connect 'jdbc:derby:alis;shutdown=true';
Mapping of java.sql.Types to SQL types
http://download.oracle.com/javadb/10.3.3.0/ref/rrefjdbc20377.html
Derby data types
http://db.apache.org/derby/docs/dev/ref/crefsqlj31068.html
online manual
http://db.apache.org/derby/manuals/#docs_10.6
 
Derby supports the following formats for TIMESTAMP:

yyyy-mm-dd hh:mm:ss[.nnnnnn]
yyyy-mm-dd-hh.mm.ss[.nnnnnn]

Derby Date Format:
yyyy-mm-dd
mm/dd/yyyy
dd.mm.yyyy

DATE Test
create table tmstp (c1 DATE);
valid query:
insert into tmstp values ('1990-03-22 10:00:00');
insert into tmstp values ('05/23/2005');
Tuning
from ij command we run the next command
call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP','T_X',0);
commit;


CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP', 'T_X', null);
execution plan ->tuning
-- turn on RUNTIMESTATISTICS for connection:
CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
-- execute complex query here -- step through the result set
-- access run time statistics information:
VALUES SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0);

No comments: