KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > DropJDOTables


1 /*
2  * $Id: DropJDOTables.java,v 1.4 2002/11/08 05:06:22 jackknifebarber Exp $
3  */

4
5 package com.triactive.jdo;
6
7 import com.triactive.jdo.SchemaManager;
8 import com.triactive.jdo.SchemaManagerFactory;
9 import java.util.Properties JavaDoc;
10 import javax.jdo.JDOHelper;
11 import javax.jdo.PersistenceManagerFactory;
12
13
14 /**
15  * A command-line utility to clear all JDO tables use with the specified
16  * database and schema.
17  *
18  * @author <a HREF="mailto:mmartin5@austin.rr.com">Mike Martin</a>
19  * @version $Revision: 1.4 $
20  */

21
22 public class DropJDOTables
23 {
24     /**
25      * Private constructor to prevent instantiation.
26      */

27
28     private DropJDOTables()
29     {
30     }
31
32
33     /**
34      * Called when the class is invoked from the command line.
35      *
36      * @param args Ignored.
37      */

38
39     public static void main(String JavaDoc[] args)
40     {
41         Properties JavaDoc props = new Properties JavaDoc();
42         props.setProperty("javax.jdo.PersistenceManagerFactoryClass",
43                           "com.triactive.jdo.PersistenceManagerFactoryImpl");
44         props.setProperty("javax.jdo.option.ConnectionDriverName", DatabaseProperties.dbDriver);
45         props.setProperty("javax.jdo.option.ConnectionURL", DatabaseProperties.dbURL);
46         props.setProperty("javax.jdo.option.ConnectionUserName", DatabaseProperties.dbUser);
47         props.setProperty("javax.jdo.option.ConnectionPassword", DatabaseProperties.dbPassword);
48
49         PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props);
50
51         SchemaManager schemaMgr = SchemaManagerFactory.getSchemaManager(pmf.getPersistenceManager());
52
53         schemaMgr.dropAllTables();
54     }
55 }
56
Popular Tags