source: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java@ 30055

Last change on this file since 30055 was 30055, checked in by ak19, 9 years ago

Fixing bug in GS3 installer that didn't use the longer password provided, despite the installer now allowing more than 8. The problem was bigger and manifold. 1. Fixed ModifyUsersDB to allow up to and incl 20 chars instead of 8. 2. Fixed the DerbyWrapper classes since the ant config-admin and config-user tasks had stopped working when global.properties was consulted for the derbyserver name and port. Now providing fallbacks again for the installer. 3. build.xml may no longer need to stop tomcat then modify the derby db and then start tomcat again because we're no longer using an embedded derby, but because we're using a networked derby, modifying the usersdb now didn't work unless greenstone (actually derby) was running. Changed the config targets to allow modifying admin and user data even if greenstone is not running, by making the update-userdb target that's called by these two tasks ensure the derbyserver is running before modifying the userdb, and stopping it if it was started up by the target.

File size: 21.4 KB
Line 
1/*
2 * DerbyWrapper.java
3 * Copyright (C) 2008 New Zealand Digital Library, http://www.nzdl.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19package org.greenstone.gsdl3.util;
20
21import java.io.File;
22import java.sql.Connection;
23import java.sql.DriverManager;
24import java.sql.PreparedStatement;
25import java.sql.ResultSet;
26import java.sql.SQLException;
27import java.sql.Statement;
28import java.util.ArrayList;
29import java.util.HashMap;
30import java.util.HashSet;
31
32import org.greenstone.gsdl3.service.Authentication;
33import org.greenstone.util.GlobalProperties;
34
35public class DerbyWrapper
36{
37 static final String PORT = GlobalProperties.getProperty("derby.server.port", "1527");
38 static final String DERBYSERVER = GlobalProperties.getProperty("derby.server", "localhost");
39 static final String PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527";
40 static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
41 static final String USERSDB = "usersDB";
42 static final String USERS = "users";
43 static final String ROLES = "roles";
44 static final String DATA = "data";
45 private Connection conn = null;
46 private static String protocol_str;
47
48 public DerbyWrapper(String dbpath)
49 {
50 connectDatabase(dbpath, false);
51 }
52
53 public static void createDatabaseIfNeeded()
54 {
55 String usersDB_dir = GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + "usersDB";
56 protocol_str = PROTOCOL + usersDB_dir;
57 File usersDB_file = new File(usersDB_dir);
58 if (!usersDB_file.exists())
59 {
60 String etc_dir = GlobalProperties.getGSDL3Home() + File.separatorChar + "etc";
61 File etc_file = new File(etc_dir);
62 if (!etc_file.exists())
63 {
64 boolean success = etc_file.mkdir();
65 if (!success)
66 {
67 System.err.println("Couldn't create the etc dir under " + GlobalProperties.getGSDL3Home() + ".");
68 }
69 }
70 try
71 {
72 DerbyWrapper.createDatabase(DriverManager.getConnection(protocol_str + ";create=true"));
73 }
74 catch (Exception ex)
75 {
76 ex.printStackTrace();
77 }
78 }
79 }
80
81 public void connectDatabase(String dbpath, boolean create_database)
82 {
83 try
84 {
85 if (conn != null)
86 {
87 System.err.println("Connection already established, close the database first");
88 return;
89 }
90
91 Class.forName(DRIVER).newInstance();
92 protocol_str = PROTOCOL + dbpath;
93 if (create_database)
94 {
95 conn = DriverManager.getConnection(protocol_str + ";create=true");
96 }
97 else
98 {
99 conn = DriverManager.getConnection(protocol_str);
100 }
101 conn.setAutoCommit(false);
102 }
103 catch (Throwable e)
104 {
105 System.out.println("exception thrown:");
106 if (e instanceof SQLException)
107 {
108 printSQLError((SQLException) e);
109 }
110 else
111 {
112 e.printStackTrace();
113 }
114 }
115 }
116
117 public void closeDatabase()
118 {
119 try
120 {
121 conn.commit();
122 conn.close();
123 conn = null;
124 }
125 catch (SQLException e)
126 {
127 e.printStackTrace();
128 }
129 }
130
131 public static void shutdownDatabaseServer()
132 {
133
134 // shutdown the server if we're using an embedded derby
135 // if we're a derby client using the derby network server
136
137 if(!DRIVER.equals("org.apache.derby.jdbc.EmbeddedDriver")) {
138 return;
139 }
140
141 boolean gotSQLExc = false;
142 try
143 {
144 DriverManager.getConnection(PROTOCOL + ";shutdown=true");
145 }
146 catch (SQLException se)
147 {
148 // this is good (i.e. what Derby is designed to do on a successful shutdown)
149 gotSQLExc = true;
150 //System.out.println("Shutdown returned: " + se);
151 }
152 catch (Exception e)
153 {
154 e.printStackTrace();
155 }
156 if (!gotSQLExc)
157 {
158 System.err.println("Warning: Derby did not shut down normally");
159 }
160 }
161
162 public void clearUserData()
163 {
164 try
165 {
166 Statement state = conn.createStatement();
167 state.execute("drop table data");
168 state.execute("create table data (username varchar(40) not null, name varchar(128) not null, value clob, primary key (username, name))");
169 conn.commit();
170 state.close();
171 }
172 catch (SQLException e)
173 {
174 e.printStackTrace();
175 }
176 }
177
178 public void clearTrackerData()
179 {
180 try
181 {
182 Statement state = conn.createStatement();
183 state.execute("drop table usertracker");
184 state.execute("create table usertracker (username varchar(40) not null, collection varchar(128) not null, site varchar(128) not null, oid varchar(128) not null, time varchar(128) not null, action varchar(128) not null, primary key (username, time))");
185 conn.commit();
186 state.close();
187 }
188 catch (SQLException e)
189 {
190 e.printStackTrace();
191 }
192 }
193
194 public static void createDatabase(Connection conn)
195 {
196 try
197 {
198 Statement state = conn.createStatement();
199 state.execute("create table users (username varchar(40) not null, password varchar(40) not null, accountstatus varchar(10), comment varchar(100), email varchar(40), primary key(username))");
200 state.execute("create table roles (username varchar(40) not null, role varchar(40) not null, primary key (username, role))");
201 state.execute("create table data (username varchar(40) not null, name varchar(128) not null, value clob, primary key (username, name))");
202 state.execute("create table usertracker (username varchar(40) not null, collection varchar(128) not null, site varchar(128) not null, oid varchar(128) not null, time varchar(128) not null, action varchar(128) not null, primary key (username, time))");
203
204 state.execute("insert into " + USERS + " values ('admin', '" + Authentication.hashPassword("admin") + "', 'true', 'change the password for this account as soon as possible', '')");
205 state.execute("insert into " + ROLES + " values ('admin', 'administrator')");
206 state.execute("insert into " + ROLES + " values ('admin', 'all-collections-editor')");
207 conn.commit();
208 state.close();
209 conn.close();
210 }
211 catch (Exception ex)
212 {
213 ex.printStackTrace();
214 }
215 }
216
217 public void addUserAction(String username, String site, String collection, String oid, String action)
218 {
219 try
220 {
221 Statement state = conn.createStatement();
222 state.execute("INSERT INTO usertracker VALUES ('" + username + "', '" + collection + "', '" + site + "', '" + oid + "', '" + System.currentTimeMillis() + "', '" + action + "')");
223 conn.commit();
224 state.close();
225 }
226 catch (Exception ex)
227 {
228 ex.printStackTrace();
229 }
230 }
231
232 public ArrayList<HashMap<String, String>> getMostRecentUserActions(String site, String collection, String oid)
233 {
234 ArrayList<HashMap<String, String>> actions = new ArrayList<HashMap<String, String>>();
235
236 try
237 {
238 String query = "SELECT username, action, time FROM usertracker WHERE site = '" + site + "' and collection = '" + collection + "' and oid = '" + oid + "' ORDER BY time";
239 Statement state = conn.createStatement();
240 ResultSet rs = state.executeQuery(query);
241 conn.commit();
242
243 HashSet<String> usernamesSeen = new HashSet<String>();
244 while (rs.next())
245 {
246 String timeStr = rs.getString("time");
247 long time = Long.parseLong(timeStr);
248
249 if (System.currentTimeMillis() - time > 6000)
250 {
251 continue;
252 }
253
254 HashMap<String, String> action = new HashMap<String, String>();
255 if (!usernamesSeen.contains(rs.getString("username")))
256 {
257 action.put("username", rs.getString("username"));
258 action.put("action", rs.getString("action"));
259 actions.add(action);
260
261 usernamesSeen.add(rs.getString("username"));
262 }
263 }
264 state.close();
265
266 clearOldUserActions();
267 }
268 catch (Exception ex)
269 {
270 ex.printStackTrace();
271 }
272 return actions;
273 }
274
275 public void clearOldUserActions()
276 {
277 try
278 {
279 Statement state = conn.createStatement();
280 state.execute("DELETE FROM usertracker WHERE (CAST (time AS BIGINT)) < " + (System.currentTimeMillis() - 20000));
281 conn.commit();
282 state.close();
283 }
284 catch (Exception ex)
285 {
286 ex.printStackTrace();
287 }
288 }
289
290 public UserQueryResult listAllUsers() throws SQLException
291 {
292 UserQueryResult userQueryResult = new UserQueryResult();
293 String sql_list_all_user = "SELECT username, password, accountstatus, email, comment FROM " + USERS;
294
295 ArrayList<HashMap<String, String>> users = new ArrayList<HashMap<String, String>>();
296 Statement state = conn.createStatement();
297 ResultSet rs = state.executeQuery(sql_list_all_user);
298 conn.commit();
299 state.close();
300
301 while (rs.next())
302 {
303 HashMap<String, String> user = new HashMap<String, String>();
304 user.put("username", rs.getString("username"));
305 user.put("password", rs.getString("password"));
306 user.put("as", rs.getString("accountstatus"));
307 user.put("comment", rs.getString("comment"));
308 user.put("email", rs.getString("email"));
309
310 users.add(user);
311 }
312
313 for (HashMap<String, String> user : users)
314 {
315 ResultSet gs = state.executeQuery("SELECT role FROM " + ROLES + " WHERE username = '" + user.get("username") + "'");
316 String group = "";
317 while (gs.next())
318 {
319 if (!group.equals(""))
320 {
321 group += ",";
322 }
323 group += gs.getString("role");
324 }
325 userQueryResult.addUserTerm(user.get("username"), user.get("password"), group, user.get("as"), user.get("comment"), user.get("email"));
326 }
327
328 if (userQueryResult.getSize() == 0)
329 {
330 System.out.println("couldn't find any users");
331 return null;
332 }
333 else
334 {
335 return userQueryResult;
336 }
337 }
338
339 public boolean addUserData(String username, String name, String value)
340 {
341 //Check if we already have a value under this name
342 boolean found = false;
343 try
344 {
345 Statement state = conn.createStatement();
346 ResultSet rs = state.executeQuery("SELECT * FROM " + DATA + " WHERE username='" + username + "' AND name='" + name + "'");
347 conn.commit();
348 if (rs.next())
349 {
350 found = true;
351 }
352 else
353 {
354 found = false;
355 }
356 state.close();
357 }
358 catch (Exception ex)
359 {
360 System.out.println("exception thrown:");
361 if (ex instanceof SQLException)
362 {
363 printSQLError((SQLException) ex);
364 ex.printStackTrace();
365 }
366 else
367 {
368 ex.printStackTrace();
369 }
370
371 System.out.println("Error:" + ex.getMessage());
372 return false;
373 }
374
375 try
376 {
377 PreparedStatement stmt = null;
378 if (!found)
379 {
380 stmt = conn.prepareStatement("INSERT INTO " + DATA + " VALUES (?, ?, ?)");
381 stmt.setString(1, username);
382 stmt.setString(2, name);
383 stmt.setString(3, value);
384 stmt.executeUpdate();
385 }
386 else
387 {
388 stmt = conn.prepareStatement("UPDATE " + DATA + " SET value=? WHERE username=? AND name=?");
389 stmt.setString(1, value);
390 stmt.setString(2, username);
391 stmt.setString(3, name);
392 stmt.executeUpdate();
393 }
394 conn.commit();
395 stmt.close();
396 }
397 catch (Exception ex)
398 {
399 System.out.println("exception thrown:");
400 if (ex instanceof SQLException)
401 {
402 printSQLError((SQLException) ex);
403 }
404 else
405 {
406 ex.printStackTrace();
407 }
408
409 System.out.println("Error:" + ex.getMessage());
410 return false;
411 }
412 return true;
413 }
414
415 public String getUserData(String username, String name)
416 {
417 try
418 {
419 Statement state = conn.createStatement();
420 ResultSet rs = state.executeQuery("SELECT * FROM " + DATA + " WHERE username='" + username + "' AND name='" + name + "'");
421 conn.commit();
422 if (rs.next())
423 {
424 return rs.getString("value");
425 }
426 state.close();
427 }
428 catch (Exception ex)
429 {
430 System.out.println("exception thrown:");
431 if (ex instanceof SQLException)
432 {
433 printSQLError((SQLException) ex);
434 }
435 else
436 {
437 ex.printStackTrace();
438 }
439
440 System.out.println("Error:" + ex.getMessage());
441 }
442 return null;
443 }
444
445 public boolean addUser(String username, String password, String groups, String accountstatus, String comment, String email)
446 {
447 try
448 {
449 Statement state = conn.createStatement();
450 String sql_insert_user = "insert into " + USERS + " values ('" + username + "', '" + password + "', '" + accountstatus + "', '" + comment + "', '" + email + "')";
451 state.execute(sql_insert_user);
452
453 String[] groupArray = groups.split(",");
454 for (String g : groupArray)
455 {
456 String sql_insert_group = "insert into " + ROLES + " values ('" + username + "', '" + g + "')";
457 state.execute(sql_insert_group);
458 }
459
460 conn.commit();
461 state.close();
462 }
463 catch (Throwable e)
464 {
465 System.out.println("exception thrown:");
466 if (e instanceof SQLException)
467 {
468 printSQLError((SQLException) e);
469 }
470 else
471 {
472 e.printStackTrace();
473 }
474
475 System.out.println("Error:" + e.getMessage());
476 return false;
477 }
478
479 return true;
480 }
481
482 public boolean deleteUser(String del_username)
483 {
484 try
485 {
486 String sql_delete_user = "delete from " + USERS + " where username='" + del_username + "'";
487 String sql_delete_groups = "delete from " + ROLES + " where username='" + del_username + "'";
488 Statement state = conn.createStatement();
489 state.execute(sql_delete_user);
490 state.execute(sql_delete_groups);
491 conn.commit();
492 state.close();
493 }
494 catch (Throwable e)
495 {
496 System.out.println("exception thrown:");
497 if (e instanceof SQLException)
498 {
499 printSQLError((SQLException) e);
500 }
501 else
502 {
503 e.printStackTrace();
504 }
505 return false;
506 }
507 return true;
508 }
509
510 public boolean deleteAllUser() throws SQLException
511 {
512 try
513 {
514 Statement state = conn.createStatement();
515 state.execute("delete from " + USERS);
516 state.execute("delete from " + ROLES);
517 conn.commit();
518 state.close();
519 }
520 catch (Throwable e)
521 {
522 System.out.println("exception thrown:");
523 if (e instanceof SQLException)
524 {
525 printSQLError((SQLException) e);
526 }
527 else
528 {
529 e.printStackTrace();
530 }
531
532 return false;
533 }
534 return true;
535 }
536
537 public UserQueryResult findUser(String username, String password)
538 {
539 UserQueryResult userQueryResult = new UserQueryResult();
540
541 String sql_find_user = "SELECT username, password, accountstatus, comment, email FROM " + USERS;
542 String append_sql = "";
543
544 if (username != null)
545 {
546 append_sql = " WHERE username = '" + username + "'";
547 }
548 if (password != null)
549 {
550 if (append_sql.equals(""))
551 {
552 append_sql = " WHERE password = '" + password + "'";
553 }
554 else
555 {
556 append_sql += " and password = '" + password + "'";
557 }
558 }
559 if (!append_sql.equals(""))
560 {
561 sql_find_user += append_sql;
562 }
563
564 try
565 {
566 ArrayList<HashMap<String, String>> users = new ArrayList<HashMap<String, String>>();
567 Statement state = conn.createStatement();
568 ResultSet rs = state.executeQuery(sql_find_user);
569 while (rs.next())
570 {
571 HashMap<String, String> user = new HashMap<String, String>();
572 user.put("username", rs.getString("username"));
573 user.put("password", rs.getString("password"));
574 user.put("as", rs.getString("accountstatus"));
575 user.put("comment", rs.getString("comment"));
576 user.put("email", rs.getString("email"));
577
578 users.add(user);
579 }
580 conn.commit();
581
582 for (HashMap<String, String> user : users)
583 {
584 ResultSet gs = state.executeQuery("SELECT role FROM " + ROLES + " WHERE username = '" + user.get("username") + "'");
585
586 String group = "";
587 while (gs.next())
588 {
589 if (!group.equals(""))
590 {
591 group += ",";
592 }
593 group += gs.getString("role");
594 }
595
596 userQueryResult.addUserTerm(user.get("username"), user.get("password"), group, user.get("as"), user.get("comment"), user.get("email"));
597 }
598 state.close();
599 }
600 catch (Exception ex)
601 {
602 ex.printStackTrace();
603 return null;
604 }
605
606 if (userQueryResult.getSize() > 0)
607 {
608 return userQueryResult;
609 }
610 else
611 {
612 return null;
613 }
614 }
615
616 // findUser(null) will return all users, which is why a UserQueryResult
617 // (a vector of UserTermInfo) is returned
618 public UserQueryResult findUser(String username)
619 {
620 UserQueryResult userQueryResult = new UserQueryResult();
621
622 String sql_find_user = "SELECT username, password, accountstatus, comment, email FROM " + USERS;
623 String append_sql = "";
624
625 if (username != null)
626 {
627 append_sql = " WHERE username = '" + username + "'";
628 }
629 if (!append_sql.equals(""))
630 {
631 sql_find_user += append_sql;
632 }
633
634 ArrayList<HashMap<String, String>> users = new ArrayList<HashMap<String, String>>();
635
636 try
637 {
638 Statement state = conn.createStatement();
639 ResultSet rs = state.executeQuery(sql_find_user);
640 conn.commit();
641 while (rs.next())
642 {
643 HashMap<String, String> user = new HashMap<String, String>();
644 user.put("username", rs.getString("username"));
645 user.put("password", rs.getString("password"));
646 user.put("as", rs.getString("accountstatus"));
647 user.put("comment", rs.getString("comment"));
648 user.put("email", rs.getString("email"));
649
650 users.add(user);
651 }
652 state.close();
653
654 state = conn.createStatement();
655 for (HashMap<String, String> user : users)
656 {
657 ResultSet gs = state.executeQuery("SELECT role FROM " + ROLES + " WHERE username = '" + user.get("username") + "'");
658 conn.commit();
659
660 String group = "";
661 while (gs.next())
662 {
663 if (!group.equals(""))
664 {
665 group += ",";
666 }
667 group += gs.getString("role");
668 }
669
670 userQueryResult.addUserTerm(user.get("username"), user.get("password"), group, user.get("as"), user.get("comment"), user.get("email"));
671 }
672 state.close();
673 }
674 catch (Exception ex)
675 {
676 ex.printStackTrace();
677 }
678
679 if (userQueryResult.getSize() > 0)
680 {
681 return userQueryResult;
682 }
683 else
684 {
685 System.out.println("couldn't find the user");
686 return null;
687 }
688 }
689
690 public String modifyUserInfo(String username, String new_password, String groups, String accountstatus, String comment, String email)
691 {
692 try
693 {
694 String sql_modify_user_info = "update " + USERS + " set ";
695
696 boolean needComma = false;
697 if (new_password != null && !new_password.equals(""))
698 {
699 sql_modify_user_info += "password='" + new_password + "'";
700 needComma = true;
701 }
702
703 if (accountstatus != null && comment != null)
704 {
705 sql_modify_user_info += (needComma ? "," : "") + " accountstatus='" + accountstatus + "'" + ", comment='" + comment + "'";
706 needComma = true;
707 }
708
709 if (email != null)
710 {
711 sql_modify_user_info += (needComma ? "," : "") + " email='" + email + "'";
712 }
713
714 sql_modify_user_info += " where username='" + username + "'";
715 Statement state = conn.createStatement();
716 state.execute(sql_modify_user_info);
717
718 String sql_delete_groups = "delete from " + ROLES + " where username='" + username + "'";
719 state.execute(sql_delete_groups);
720
721 String[] groupsArray = groups.split(",");
722 for (String g : groupsArray)
723 {
724 String sql_insert_group = "insert into " + ROLES + " values ('" + username + "', '" + g + "')";
725 state.execute(sql_insert_group);
726 }
727
728 conn.commit();
729 state.close();
730 }
731 catch (Throwable e)
732 {
733 System.out.println("exception thrown:");
734 if (e instanceof SQLException)
735 {
736 printSQLError((SQLException) e);
737 }
738 else
739 {
740 e.printStackTrace();
741 }
742
743 return "Error:" + e.getMessage();
744 }
745 return "succeed";
746 }
747
748 public void db2txt()
749 {
750 System.err.println(db2txtString());
751 }
752
753 public String db2txtString()
754 {
755 //String db2txt = "Error in converting db2txt string.";
756 String db2txt = "";
757 try
758 {
759 String sql_list_all_user = "select username, password, accountstatus, comment, email from " + USERS;
760
761 Statement state = conn.createStatement();
762 ResultSet rs = state.executeQuery(sql_list_all_user);
763
764 ArrayList<HashMap<String, String>> infoMap = new ArrayList<HashMap<String, String>>();
765
766 while (rs.next())
767 {
768 HashMap<String, String> userMap = new HashMap<String, String>();
769 userMap.put("username", rs.getString("username"));
770 userMap.put("password", rs.getString("password"));
771 userMap.put("status", rs.getString("accountstatus"));
772 userMap.put("comment", rs.getString("comment"));
773 userMap.put("email", rs.getString("email"));
774 infoMap.add(userMap);
775 }
776 conn.commit();
777
778 StringBuffer buffer = new StringBuffer();//("-------------------------------------");
779 for (HashMap<String, String> user : infoMap)
780 {
781 ResultSet groupsSet = state.executeQuery("SELECT role FROM " + ROLES + " WHERE username = '" + user.get("username") + "'");
782 String returnedGroups = "";
783 while (groupsSet.next())
784 {
785 if (!returnedGroups.equals(""))
786 {
787 returnedGroups += ",";
788 }
789 returnedGroups += groupsSet.getString("role");
790 }
791 conn.commit();
792
793 buffer.append("USERNAME = " + user.get("username"));
794 buffer.append("\nPASSWORD = " + user.get("password"));
795 buffer.append("\nGROUPS = " + returnedGroups);
796 buffer.append("\nSTATUS = " + user.get("status"));
797 buffer.append("\nCOMMENT = " + user.get("comment"));
798 buffer.append("\nEMAIL = " + user.get("email"));
799 buffer.append("\n-------------------------------------\n");
800 }
801 db2txt = buffer.toString();
802
803 conn.commit();
804 state.close();
805 }
806 catch (Exception ex)
807 {
808 ex.printStackTrace();
809 }
810 finally
811 {
812 return db2txt;
813 }
814 }
815
816 static void printSQLError(SQLException e)
817 {
818 while (e != null)
819 {
820 System.out.println(e.toString());
821 e = e.getNextException();
822 }
823 }
824
825 public void clearUserDataWithPrefix(String username, String prefix)
826 {
827 try
828 {
829 Statement state = conn.createStatement();
830 state.execute("DELETE FROM data WHERE username = '" + username + "' AND SUBSTR(name, 1, " + prefix.length() + ") = '" + prefix + "'");
831 conn.commit();
832 state.close();
833 }
834 catch (Exception ex)
835 {
836 ex.printStackTrace();
837 }
838 }
839}
Note: See TracBrowser for help on using the repository browser.