Changeset 12033
- Timestamp:
- 2006-07-06T13:09:34+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/BerryBasket.java
r12016 r12033 63 63 protected static final String delimiter ="|"; 64 64 protected static final int delay = 1800000; 65 66 protected SQLConnection connection = null;67 65 68 66 protected Hashtable userMap = null; … … 145 143 146 144 147 // check the database;148 this.connection = GS3SQLConnectionFactory.getSQLConnection(DATABASE_NAME);149 if (this.connection == null) {150 System.err.println("db was null");151 // connect to the default database, and create the new database152 this.connection = GS3SQLConnectionFactory.getSQLConnection();153 if (this.connection == null) {154 // we can't do anything155 return false;156 }157 System.err.println("connected to test");158 // create the new one159 if (!this.connection.createDatabase(DATABASE_NAME)) {160 //this.connection.close();161 this.connection = null;162 return false;163 }164 System.err.println("created new one");165 // connect to it166 if (!this.connection.connectToDatabase(DATABASE_NAME)) {167 //this.connection.close();168 this.connection = null;169 return false;170 }171 System.err.println("reconnected");172 // set up the tables173 if (!initialiseDatabase()) {174 //this.connection.close();175 this.connection = null;176 return false;177 }178 System.err.println("initialised");179 } else {180 // check the database181 if (!checkDatabase()) {182 //this.connection.close();183 this.connection = null;184 return false;185 }186 }187 145 return true; 188 146 … … 239 197 240 198 return null; 241 }242 243 protected boolean initialiseDatabase() {244 245 return true;246 }247 protected boolean checkDatabase() {248 String command = "select * from items;";249 try {250 Statement s = this.connection.createStatement();251 s.execute(command);252 s.close();253 } catch (Exception e) {254 return false;255 }256 return true;257 199 } 258 200
Note:
See TracChangeset
for help on using the changeset viewer.