01: /*
02: * $Id: DropJDOTables.java,v 1.4 2002/11/08 05:06:22 jackknifebarber Exp $
03: */
04:
05: package com.triactive.jdo;
06:
07: import com.triactive.jdo.SchemaManager;
08: import com.triactive.jdo.SchemaManagerFactory;
09: import java.util.Properties;
10: import javax.jdo.JDOHelper;
11: import javax.jdo.PersistenceManagerFactory;
12:
13: /**
14: * A command-line utility to clear all JDO tables use with the specified
15: * database and schema.
16: *
17: * @author <a href="mailto:mmartin5@austin.rr.com">Mike Martin</a>
18: * @version $Revision: 1.4 $
19: */
20:
21: public class DropJDOTables {
22: /**
23: * Private constructor to prevent instantiation.
24: */
25:
26: private DropJDOTables() {
27: }
28:
29: /**
30: * Called when the class is invoked from the command line.
31: *
32: * @param args Ignored.
33: */
34:
35: public static void main(String[] args) {
36: Properties props = new Properties();
37: props.setProperty("javax.jdo.PersistenceManagerFactoryClass",
38: "com.triactive.jdo.PersistenceManagerFactoryImpl");
39: props.setProperty("javax.jdo.option.ConnectionDriverName",
40: DatabaseProperties.dbDriver);
41: props.setProperty("javax.jdo.option.ConnectionURL",
42: DatabaseProperties.dbURL);
43: props.setProperty("javax.jdo.option.ConnectionUserName",
44: DatabaseProperties.dbUser);
45: props.setProperty("javax.jdo.option.ConnectionPassword",
46: DatabaseProperties.dbPassword);
47:
48: PersistenceManagerFactory pmf = JDOHelper
49: .getPersistenceManagerFactory(props);
50:
51: SchemaManager schemaMgr = SchemaManagerFactory
52: .getSchemaManager(pmf.getPersistenceManager());
53:
54: schemaMgr.dropAllTables();
55: }
56: }
|