Hi everyone,The following code is essentially a point in polygon QA tool where the points have related values in an external database. If the polygon value calculated from GIS is different from the value stored in the external database, then the external database is updated with the value from GIS.Sounds straight forward enough and it works, but after a while (around 3500 records) it just stops dead, no error produced, and SDE stops accepting connections... The only lead I've got is an 'ORA-1000: maximum open cursors exceeded' that appeared when I tried to view a table from an open arcmap session. I've set all the features as direct connect to try and cut SDE out of the equation but have the same issues.All the help I've seen on the ORA-1000 issue refer to releasing the COM object explicitly, but all I can call is 'del Curs'I've included the looping bit of code below so hopefully someone spots something!My suspicion is around the # identify polygon area, is there a better way to return the field value than open a cursor?Thanks in advance!Steven
rows = gp.searchCursor(gis_parcels, sql_q) # all parcel records
row = rows.next()
while row:
# build parcel centroid to query against zoning layer.
newPoint = gp.CreateObject("Point")
newPoint.x = row.shape.centroid.x
newPoint.y = row.shape.centroid.y
point = makeTempPointFClass('C:\\temp', newPoint) # Makes a temporary point file so can make feature layer, uses an insert cursor which is deleted.
gp.makefeaturelayer(point, 'point')
#identify polygon area
gp.selectlayerbylocation('fl_gis', 'INTERSECT', 'point', 0, 'NEW_SELECTION')
# test number of values returned, should only be 1
if gp.GetCount_management('fl_gis').getoutput(0) == '1':
Curs = gp.searchcursor('fl_gis')
gis_value = str(Curs.next().GetValue(gisField[modeKey]))
del Curs
# Verify that the GIS zone is a valid Tidemark zone
if gis_value in valid_zones:
# get pid and query oracle for all instances of it and strata addresses.
gis_roll = row.PRC_ROLL_NO
allAddsCurs.execute(None, {'roll':str(gis_roll)}) # cx_Oracle call
ox_rows = allAddsCurs.fetchall() # returns all external database values associated with the point
if ox_rows == None:
print str(uroll) + ' has no valid addresses??'
else:
for ox in ox_rows:
if (gis_value <> str(ox[cols[oxField[modeKey]]]) and ox[cols['PRC_ROLL_NO']] <> None):
uroll = str(ox[cols['PRC_ROLL_NO']])
print str(row.PRC_PARCEL_NO) +" gis: " + str(gis_value) + ' tm: ' + str(ox[cols[oxField[modeKey]]])
try:
updateCurs.execute(None, {'gis_value':gis_value, 'uroll':uroll}) # cx_Oracle call
except Exception, ErrorDesc:
print "update failed : " + str(uroll)
else:
print 'GIS zone is not in tidemark validation table.'
else:
print "Multiple or no potential values found for: " + str(row.PRC_PARCEL_NO)
count += 1
row = rows.next()
conn.commit()
del rows, row