Project

General

Profile

« Previous | Next » 

Revision 1217

Added by Jing Tao almost 22 years ago

Merge DBConnection branch to head.

View differences:

AssociateAccessPolicy.java
62 62

  
63 63
 
64 64
 
65
  private Connection  conn = null;
65
  private DBConnection  conn = null;
66 66
  private Vector docIdInAccessTable=null;
67 67
  private Vector docIdWithoutAccessEntry=null;
68 68
  private Vector notFoundDataSetId=null;
......
75 75
   */
76 76
  static public void main(String[] args) 
77 77
  {
78
     Connection localConn=null;
79
     MetaCatUtil localUtil=new MetaCatUtil();
78
     DBConnection localConn=null;
79
     int serialNumber = -1;
80
     //MetaCatUtil localUtil=new MetaCatUtil();
80 81
     AssociateAccessPolicy policy=null;
81 82
     try
82 83
     {
83
      localConn=localUtil.openDBConnection();
84
      localConn=DBConnectionPool.getDBConnection("AssociateAccessPolict.main");
85
      serialNumber=localConn.getCheckOutSerialNumber();
84 86
      policy = new AssociateAccessPolicy(localConn);
85 87
      policy.associateAccess();
86
      localConn.close();   
88
      //localConn.close();   
87 89
     }//try
88 90
     catch (Exception e) 
89 91
     {
90 92
        System.err.println("Error in AssociateAccessPolicy.main");
91 93
        System.err.println(e.getMessage());
92 94
        e.printStackTrace(System.err);
93
     } 
95
     }
96
     finally
97
     {
98
       DBConnectionPool.returnDBConnection(localConn, serialNumber);
99
     }//finally
100
     
94 101
     if (!(policy.getNotFoundDataSetId()).isEmpty())
95 102
     {
96 103
         
......
126 133
   * @param parserName the fully qualified name of a Java class implementing
127 134
   *                   the org.xml.sax.XMLReader interface
128 135
   */
129
  public AssociateAccessPolicy( Connection conn) 
136
  public AssociateAccessPolicy( DBConnection conn) 
130 137
                  throws IOException, 
131 138
                         SQLException, Exception
132 139
  {   
......
166 173
    PreparedStatement pStmt;
167 174
    String docId;
168 175
    ResultSet rs=null;
169
    Connection dbConn=null;
170
    if (conn == null || conn.isClosed())
171
    {
172
      dbConn = util.openDBConnection();
173
    }
174
    else
175
    {
176
      dbConn=conn;
177
    }
176
    
178 177
    //the query stirng
179 178
    String query="SELECT docid from xml_access";
180 179
    try
......
221 220
                      throws SQLException, McdbException,Exception
222 221
  {
223 222
    PreparedStatement pStmt;
224
    Connection dbConn=null;
223
    
225 224
    String query=null;
226
    if (conn == null || conn.isClosed())
227
    {
228
      dbConn = util.openDBConnection();
229
    }
230
    else
231
    {
232
      dbConn=conn;
233
    }
225
  
234 226
    //the query stirng
235 227
    //we let accessfileid blank becuause we couldn't know access file
236 228
    query="INSERT INTO xml_access " + 
......
262 254
    PreparedStatement pStmt=null;
263 255
    String docId;
264 256
    ResultSet rs=null;
265
    Connection dbConn=null;
266
    if (conn == null || conn.isClosed())
267
    {
268
      dbConn = util.openDBConnection();
269
    }
270
    else
271
    {
272
      dbConn=conn;
273
    }
257

  
258
   
274 259
    //the query stirng
275 260
    String query="SELECT docid from xml_documents";
276 261
    try

Also available in: Unified diff