From: O'Brien-Strain, E. <eo...@ex...> - 2001-09-24 19:56:10
|
Instead of "conlist[i] = x" you can use "conlist.append(x)" __ Eamonn O'Brien-Strain HP Labs eo...@hp... > -----Original Message----- > From: R Datta [mailto:rd...@cr...] > Sent: Monday, September 24, 2001 12:23 PM > To: jyt...@li... > Subject: [Jython-users] List issue > > > Guys, > > I am trying to create a pool of JDBC connections, storing > them in a list > called conlist. Here is the relevant snippet. > > 40 conlist= [] > 41 for i in xrange(threadCount): > 42 url = "jdbc:mysql://%s/%s?user=%s&password=%s" % > (server, db, > usr, passwd) > 43 print "Connection # ",i > 44 conlist[i]=DriverManager.getConnection(url) > 45 sleep(0.5) > > It gives me the following error: > Connection # 0 > Traceback (innermost last): > File "cxjdbcThread1.py", line 44, in ? > IndexError: index out of range: -1 > > I must be making some very obvious mistake, but I can't find > it. If there > is a better (more efficient) way of storing the connection > objects, pls > tell me. > Please help! > > Thanks > Raj Datta > Professional Services Direct : > 408-530-4932 > CrossAccess Corp Cell : > 408-316-5473 > 2900 Gordon Ave #100 Fax : 408-735-0328 > Santa Clara CA 95051 Email : > rd...@cr... > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |