31.07.2013 Views

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Main.java (part 4):<br />

em.close();<br />

entityManagerFactory.close();<br />

}<br />

}<br />

Compiling and running the <strong>Cluster</strong>JPA tutorial code<br />

javac -classpath /usr/local/mysql/share/mysql/java/clusterjpa.jar:/usr/local/<br />

openjpa/openjpa-1.2.1.jar:/usr/local/openjpa/lib/geronimo-jpa_3.0_spec-1.0.jar:.<br />

Main.java Employee.java Department.java<br />

java -Djava.library.path=/usr/local/mysql/lib/ -classpath /usr/local/mysql/<br />

share/mysql/java/clusterjpa.jar:/usr/local/openjpa/openjpa-1.2.1.jar:/usr/local/<br />

openjpa/lib/*:/usr/local/connectorj/mysql-connector-java-5.1.12-bin.jar:. Main<br />

Exercise<br />

1. Move to the folder containing the <strong>Cluster</strong>JPA example:<br />

cd /usr/local/clusterj_example_wp_7_1_2a<br />

2. Compile the software:<br />

javac -classpath /usr/local/mysql/share/mysql/java/clusterj-api.jar:.<br />

Main.java Employee.java<br />

3. Run the software:<br />

java -classpath /usr/local/mysql/share/mysql/java/clusterj.jar:. -<br />

Djava.library.path=/usr/local/mysql/lib Main<br />

4. Check the contents of the database at each opportunity<br />

Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 67/81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!