Project

General

Profile

« Previous | Next » 

Revision 518

Added by bojilova about 24 years ago

change for using the db connection

View differences:

src/edu/ucsb/nceas/metacat/relationHandler.java
31 31
   * relations.
32 32
   * @param xmldoc the xml document to index.
33 33
   */
34
  public relationHandler(DocumentImpl xmldoc, Connection con)
34
  public relationHandler(DocumentImpl xmldoc, Connection conn)
35 35
  {
36
    try
37
    {
38
      //conn = util.getConnection();
39
      if(conn == null)
40
      {
41
        conn = util.getConnection();
42
      }
43
      else
44
      {
45
        this.conn = con;
46
      }
47
    }
48
    catch(Exception e)
49
    {
50
      System.out.println("error getting db connection in relationhandler:");
51
      System.out.println(e.getMessage());
52
    }
53
    
36
    this.conn = conn;    
54 37
    this.xmldoc = xmldoc;
55 38
    if(xmldoc.getDoctype().equals(util.getOption("packagedoctype")))
56 39
    { //make sure this doctype is a package document then run the thread
......
173 156
      }
174 157
      
175 158
      conn.commit();
176
      util.returnConnection(conn);
177 159
      btThread = null;
178
    }
179
    catch(Exception e)
180
    {
160

  
161
    } catch(Exception e) { 
162
      try { 
163
        conn.rollback();
164
      } catch (SQLException sqle) {}
181 165
      System.out.println("Error in relationHandler: " + e.getMessage());
182 166
      util.debugMessage("Error in relationHandler: " + e.getMessage());
183 167
      e.printStackTrace(System.out);

Also available in: Unified diff