Project

General

Profile

« Previous | Next » 

Revision 184

cleaned up code for getting options from the properties file, made the database connection inthe MetaCatUtil class use the properties file for the conneciton info

View differences:

DBTransform.java
28 28
 */
29 29
public class DBTransform {
30 30

  
31
  static  String 	defaultDB = "jdbc:oracle:thin:@localhost:1521:test";
32 31
  private Connection	conn = null;
33 32

  
34 33
  /**
......
134 133
  /**
135 134
   * the main routine used to test the transform utility.
136 135
   *
137
   * Usage: java transform <user> <password> [dbstring]
138
   *
139
   * @param user the username to use for the database connection
140
   * @param password the password to use for the database connection
141
   * @param dbstring the connection info to use for the database connection
136
   * Usage: java DBTransform
142 137
   */
143 138
  static public void main(String[] args) {
144 139
     
145
     if (args.length < 2)
140
     if (args.length > 0)
146 141
     {
147 142
        System.err.println("Wrong number of arguments!!!");
148
        System.err.println("USAGE: java transform " +
149
                           "<user> <password> [dbstring]");
143
        System.err.println("USAGE: java DBTransform");
150 144
        return;
151 145
     } else {
152 146
        try {
153 147
                    
154
          String user     = args[0];
155
          String password = args[1];
156
          String dbstring = null;
157

  
158
          if (args.length <= 2) {
159
            dbstring = defaultDB;
160
          } else {
161
            dbstring = args[2];
162
          }
163

  
164 148
          // Open a connection to the database
165
          Connection dbconn = MetaCatUtil.openDBConnection( 
166
                              "oracle.jdbc.driver.OracleDriver",
167
                              dbstring, user, password);
149
          MetaCatUtil   util = new MetaCatUtil();
150
          Connection dbconn = util.openDBConnection();
168 151

  
169 152
          // Create a test document
170 153
          StringBuffer testdoc = new StringBuffer();
......
188 171
     }
189 172
  }
190 173
  
191
  public void dbg(int position) {
174
  private void dbg(int position) {
192 175
    System.err.println("Debug flag: " + position);
193 176
  }
194 177

  

Also available in: Unified diff