Project

General

Profile

« Previous | Next » 

Revision 683

Added by berkley about 23 years ago

fixed some problems with database connections getting a time out error. Also updated some catch statements

View differences:

DocumentIdentifier.java
109 109
    
110 110
    try
111 111
    {
112
      conn = util.openDBConnection();
112
      try
113
      { //this connection is prone to error for some reason so we 
114
        //try to connect it three times before quiting.
115
        conn = util.openDBConnection();
116
      }
117
      catch(SQLException sqle)
118
      {
119
        try
120
        {
121
          conn = util.openDBConnection();
122
        }
123
        catch(SQLException sqlee)
124
        {
125
          try
126
          {
127
            conn = util.openDBConnection();
128
          }
129
          catch(SQLException sqleee)
130
          {
131
            System.out.println("error getting db connection in " + 
132
                               "MetacatReplication.handleGetDocumentRequest: " +
133
                               sqleee.getMessage());
134
          }
135
        }
136
      }
113 137
      pstmt = conn.prepareStatement("select rev from xml_documents where " +
114 138
                                    "docid like '" + docid + "'");
115 139
      pstmt.execute();
......
122 146
        conn.close();
123 147
        return retStr;
124 148
      }
149
      conn.close();
125 150
    }
126 151
    catch(Exception e)
127 152
    {
153
      System.out.println("error in DocumentIdentifier.getNewestRev(): " +
154
                          e.getMessage());
128 155
      try
129 156
      {
130 157
        conn.close();
131 158
      }
132 159
      catch(Exception e2)
133 160
      {}
134
      System.out.println("error closing db connection in " + 
135
                         "DocumentIdentifier.getNewestRev " + 
136
                          e.getMessage());
137 161
    }
138 162
    return "1";
139 163
  }

Also available in: Unified diff