From: brian z. <bz...@zi...> - 2001-09-24 19:44:12
|
You can not insert into a python list if it is not sized sufficiently, instead try: 44 conlist.append(DriverManager.getConnection(url)) brian ----- Original Message ----- From: "R Datta" <rd...@cr...> To: <jyt...@li...> Sent: Monday, September 24, 2001 2:23 PM 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 |