This stand-alone sample demonstrates the RDB Data Access Service in the context of a simple java application.
Apache Ant latest version installed.
Download Apache Ant latest version on and extract into folder <apache_ant_folder>. You can find it here: http://ant.apache.org/bindownload.cgi.
Add <apache_ant_folder>/bin directory to your OS path variable.
On console change the actual directory to <tuscany_das_java_distribution>/samples/customer/ and execute ant application:
<tuscany_das_java_distribution>/samples/customer/ > ant
The sample will run and output the following:
Buildfile:
build.xml
run:
[java]
connection info from config***************
[java]
dbName:jdbc:derby:target/dastest; create = true user:
password:
[java]
******************************************
[java]
Setting up for derby run!
[java] Dropping
tables
[java] Dropping procedures
[java]
Creating tables
[java] Creating
procedures
[java] Inserting data in
tables
[java] Database setup complete!
[java]
log4j:WARN No appenders could be found for logger
(org.apache.tuscan
y.das.rdb.impl.Parameters).
[java]
log4j:WARN Please initialize the log4j system properly.
[java]
Result:select all customers
[java] ID:1
LASTNAME:John ADDRESS:USA
[java] ID:2
LASTNAME:Amita ADDRESS:INDIA
[java] ID:3
LASTNAME:Patrick ADDRESS:UK
[java] ID:4
LASTNAME:Jane ADDRESS:UN
[java] Result:insert
new customer
[java] ID:1 LASTNAME:John
ADDRESS:USA
[java] ID:2 LASTNAME:Amita
ADDRESS:INDIA
[java] ID:3 LASTNAME:Patrick
ADDRESS:UK
[java] ID:4 LASTNAME:Jane
ADDRESS:UN
[java] ID:5 LASTNAME:Jenny
ADDRESS:USA
[java] Result:update first
customer
[java] ID:1 LASTNAME:BlueBerry
ADDRESS:USA
[java] ID:2 LASTNAME:Amita
ADDRESS:INDIA
[java] ID:3 LASTNAME:Patrick
ADDRESS:UK
[java] ID:4 LASTNAME:Jane
ADDRESS:UN
[java] ID:5 LASTNAME:Jenny
ADDRESS:USA
[java] Result:delete last
customer
[java] Deleting customer named:
Jenny
[java] ID:1 LASTNAME:BlueBerry
ADDRESS:USA
[java] ID:2 LASTNAME:Amita
ADDRESS:INDIA
[java] ID:3 LASTNAME:Patrick
ADDRESS:UK
[java] ID:4 LASTNAME:Jane
ADDRESS:UN
BUILD SUCCESSFUL
Total
time: 29 seconds
Observation: The build.xml ant file only works on DAS Java binary distribution.